How do they do it? Why only 5 characters?
The only sure way to know is ask jsFiddle, so this part of your question is not really constructive.
The UIDs are not generates sequentially, which is probably to prevent someone from browsing thorugh everybody else's fiddles.
How do they make sure there's never a collision?
That part is simple: You can just generate one at random and check if it does not exists already.
If it doesn't, you are done. If it does, repeat.
As long as there at least as much unused UIDs as used ones, you don't have to repeat more than once most times.
Can they run out of UIDs some day?
With a 52 letter alphabet (
a-z), you have
52 ^ 5 = 380,204,032 different UIDs available.
That already is a lot of fiddles, but if they ever run out, they could just add a sixth letter.