In 1st edition, there was this lovely little thing called a "% chance to learn spell".
I had a magic-user blow his chance to learn Detect Invisible. Another mage I had blew his roll for the Invisibility spell. Neither of them will ever be able to learn those spells.
In that campaign, when you went up a level, you went to someone to train. That person might like you... or might not. And a magic-user could only teach a spell that they knew. So you could ask for a particular spell, and if your teacher liked you and knew the spell, they'd teach it to you. Then you'd see if you could learn it. IF they didn't like you, they might teach you a similar spell or at least one from the same school. If they hated you, they'd teach you the most useless spell they knew (Zephyr is one that comes to mind... though I think I did use it once in a useful manner).
You could also learn spells from scrolls and spellbooks you ran across, but that didn't happen too often. Many times, the spellbooks we found were trapped.
This is something that is discouraged in 3rd edition. In 3e, you have a guarantee that you will get the two spells you want to get when you level up. And you can repeat attempts to learn a spell every level, if you failed a spellcraft check when learning from a captured spellbook or scroll.
The key to diversity among spellcasters is the DM controlling what spells are available in the campaign.