Constructing a Library on a Spire allows you to research magical knowledge, Edicts, and Artifacts. Once built, resting in any Spire grants a bonus to Lore and all Magic skills. It's a good idea to construct the library first, as it will allow the most time to conduct research and will greatly increase the functionality of your other upgrades once you acquire them.
Sage Garus arrives at your library to manage your efforts, and provides a convenient interface for researching items. Research proceeds as your party gains experience and requires scrolls and Spire recruits to begin.
You can recruit master trainers to train your magic skills; without Library trainers, only one recruit each at the Mountain Spire and the Training grounds can train you in a limited number of magic skills.
Note that increasing skill points via training is limited per character level; once you have reached the limit for the current character level, the character has to reach the next level before you can further increase skill points by training. This means that you have to choose between improving your stronger skills for more character experience to gain a level, or brushing up on your weaker skills.
With New Game+, you can build the Library just before resolving The Armies in the North, allowing you to save maintenance and still improve the Fatebinder for the next playthrough.
Research is conducted as time passes, started when you gain experience. To maximize the library's output, travel back to it and check on Garus every time you complete a quest or location.
Researching artifacts requires at least 8 scrolls and four recruits at the library.