Wiki Is Your Friend
Basically, a website with a shorter name is used as a place holder, such as bit.ly.
Then, bit.ly generates a key for the user to provide, which is randomly generated to not repeat. With 35 character options and 8 or so values, do the math. That’s a lot of possible keys. If a URL is equal to a previously existing key, I remember reading somewhere that they reuse keys as well.
They don’t really use a specific programming language, they just use a simple URL redirect, which can be done with HTTP response status code 301, 302, 307 or 308, depending.