Sorted Storage

As you get each key, you re-hang all the keys on the pegs to keep them sorted by their tag number. When it comes time to find the right set of keys, you can quickly narrow down where the key is by comparing its value to its neighbors. If you're a computer, you keep chopping the number of keys left to look at in half using a binary search tree algorithm (less complicated than it sounds), or if you're a human you less efficiently scan the keys until you get into the right range. (Less efficient if a computer were to do it, but you can make good guesses at where it's going to be and start off pretty well.)

"Holy freaking woodness, my groin exploded!"

The problem with this technique is twofold. It still does take longer to find the right key as you get more keys (though the search goes more quickly than the linear, check-'em-all approach), but moreover it's a problem to store the keys. You have to find the right spot for the new key, and move all the other keys after that one to make room. Bleh!

Bucket Sort

If you know ahead of time how many different kinds of numbers you might get, you could set up the board ahead of time to make room for them all, and when a new key comes in you drop it on the associated peg. That way you're sorting the keys as they come in, while leaving space for new keys to be inserted into the middle of the system without having to do the jingle-jangle shuffle. Problems: 1) there are many cases when you don't know ahead of time what numbers you might have to sort (maybe the owners write down a number themselves) and 2) Even if you do know the range ahead of time, it may be wildly inefficient to create a space for every possibility. What if you know that the numbers can be from 1 to 1000? Do you create 1000 nail spots for your 10-cars-a-night-business? Foolish.