Yeah I've seen Valve run out of keys for games in the middle of Steam sales in the past. I believe PSN and Steam both buy keys in advance still. Microsoft have a lot more money to throw at their POS system and seem to have figured out a way to generate licences and what they call 5x5's (25 digit codes) on the fly. Apple seems to be generating everything on the fly also as they imbed the owners details into the purchased files metadata as a really weak form of copy protection.
In Apple's case the reason you preorder is not because they will run out of copies. It's because the content will be available instantly when it is released and in the case of many big releases now on iTunes it may even be available to you before release. I had 5 tracks prereleased from Linkin Park's new album before it ever hit shelves. I see banners on iTunes all the time for movies including blockbusters like Star Trek Into Darkness and Frozen saying you can get it on iTunes before the official release.