The Librarian Who Taught AI to Think: How Retrieval-Augmented Generation Works