Mechanically, there is nothing particularly special about spells when compared to other abilities a character can learn. If you require warriors to find a tutor in order to become polearm specialists, magicians might also require a teacher to learn spells. On the other hand, if fighters get stronger as they level up, there is nothing stopping you from just giving new spell away.
Of course, any given system can play with these ideas. For example, in old school D&D, some spells might be stronger than anything a warrior could ever accomplish, so it would make sense that the magic-users would get random spells from adventuring - the same way fighters would get magical weapons.
Alternatively, each class may have their own ways of learning spells. Clerics might gain them automatically, while magic-users must study, and paladins will LOSE their spells if they ever steer away from their righteous path!
D&S often separates spells between "divine" and "arcane" spells. Personally, I don't care much for this distinction. Both types of spells work almost identically, and some spells are both divine an arcane, so both clerics and magic-users can cast them.
It seems to be the best way deal with spells in order to maximize adventure possibilities is letting PCs get their spells any way they want - despite their class. And once they get it, it is theirs - for good or ill.
Paladins and clerics can pray their lawful deities for a spell top aid their efforts... But the deity may ask for a quest or proof of faith.
Chaotic deities, on the other hand, will be more flexible - they might exchange spells for goods and services.
A paladin that falls from grace still keeps his powers - making fallen paladins the stuff of legend! What is worse, they can pledge loyalty to an evil, rival deity becoming more powerful in the process. There is always a high demand for turncloak healers in the Evil Lord's army! That is why lawful deities are so careful when choosing their clerics and paladins!
Of course, forgotten tomes of forbidden lore are also useful when studying magic. Their authors must guarde them carefully, or such secrets might be turned against them.
On the other hand, casting spells you haven't memorized should always be dangerous. Magicians can also create "trap grimoires" to fool their rivals.
And magic has a will of its own. Casting an unknown spell repeatedly will make it enter your memory whether you like it or not. While this has no apparent downsides, it occupies a chunk or your brain that might be better used for other stuff (or other spells) - which is why fighters and thieves usually shy away from such books unless they have some arcane ability themselves.
In short, this means the mechanics of spells are always similar, but they way you acquire them is different in the game world.
I have added most of these ideas to my Dark Fantasy Basic game. If you like this, you might want to check it out:
On the other hand, most pages of Dark Fantasy Basic are meant to be used with any OSR game; if you prefer, you can pick this single page and adapt it to your own games (more about this concept here).
How to do this in 5e?
If you want these concepts applied to 5e, just let characters go searching for patrons, tutors or deities to give them spells (AND feats - there is no reason to exempt non-spellcasters from these hardships!). Of course, these will make the game significantly harder, so such quests should grant extra-XP by themselves and should never be mandatory.
Doing this for every single spell might be a hassle (especially for Wizards, etc.), so the GM can choose to guard a few spells instead (spells such as Wish, for example), or let spellcasters TRADE spells for new ones - this doesn't mean they lose their spells, but they will teach the spells they know in order to learn new ones.
What's the point?
This gives the PCs lots of reason to:
- Interact with the warlock's patrons.
- Deal with powerful entities in a non-violent way.
- Follow a deity's commands (for a paladin, cleric, or just a warrior that needs to cure his wounds!).
- Go searching for a rival wizard's grimoire.
- Go through ancient catacombs in search of forgotten scrolls.
- Fear for their soul when they read an unknown book with a cover made of human skin!
Just don't let it become a nuisance to your players!