1) Why do some websites use letters in their IDs? Are they strings?
We don't know if those websites store IDs in their database as strings. Numbers and strings are really the same to computers. A string is just a number, just shown with a different base. 'A' = 0x41 = 65 = 0b1000001
, to the computer it's all the same. But if you display it, the larger the base, the shorter the representation, and shorter URLs are easier to read and share for humans. Sites like YouTube and Imgur use base 62 (letters, upper and lower case, plus digits) or larger (add a dash or other valid URL characters), which is relatively short for big numbers. What would you prefer to use, youtu.be/23489234892348234933
or youtu.be/B9k6KMrv8vh
?
2) Why are non-sequential IDs used?
The answer by IMil explains it well:
Youtube can't use sequentional IDs for two reasons:
Its databases are almost certainly distributed, making sequential numbering complicated.
It has a privacy option "Unlisted videos": those that don't show up in the search results, but are available if you know the ID.
These also explain why the IDs are so large: (YouTube doesn't host 23,489,234,892,348,234,933 different videos, obviously)
When generating IDs, it's a problem if you accidentally generate the same ID twice, so you need a big ID space to prevent the birthday problem
People can just guess the URL of unlisted videos if the chance of any given valid ID being used for a video isn't very, very small.