Generally, Library is nothing more than a slightly glorified Smithy that can conveniently toss aside unwanted Actions. But its true power, the one that justifies its placement in the elite $5 tier of Actions, is its ability to draw additional cards for each fewer card in your hand. This might happen when your opponent Militias or Goons you, but it can also happen if you have useful non-terminal, non-self-replacing Actions like Minion. With Universities and Festivals, though, the Library can become part of an +Action/+Card engine that draws 7 cards at a time — not to mention the benefits you got from the Universities and Festivals themselves!
Watchtower can substitute for Library. Shanty Towns, Native Villages, Fishing Village, and Festivals can also substitute for the University, but University/Library is one of the rare instances where Dominion makes thematic sense.
Although Festivals are generally easier to get and give +2 Coin, Universities have a nice benefit of grabbing you additional Libraries. In this game, theory also uses Universities to go for a 3-pile ending. He chooses to grab Woodcutters, which both scores for Vineyards and also helps get them (since Vineyards have such an inconvenient cost).