I can't find anything in the D&D 5e books about learning spells as an arcane spellcaster.
I have a question:
- As, say, a Wizard levels up and gets new spell slots, does he need to go to a library and find the spell somewhere? Could he learn a spell he saw someone else cast?
Best Answer
The Wizard
At leveling up you are allowed to simply choose two spells from the wizard list and declare that they are now in your spellbook. (PHB p.114: Learning Spells of 1st Level and Higher)
But there's more! You can build up your spellbook much quicker than that: see the sidebar "Your Spellbook" on p. 114 of the PHB. This describes the sort of process you mention, whereby you add to your spellbook by studying another wizards' copy, reading a scroll, or even through original research. (This, in my opinion, is the sine qua non of the wizard: the ability to build up such a large repertoire from which to prepare every day.)
See also this answer to Is it possible for a wizard to change the spells in her spellbook?
The Bard
@DaleM's excellent answer: