Sometimes it's at the beginning of the project, when you need to dig into another time or place or career or lifestyle that you're not familiar with. Then you can build characters and setting and plot from all the great research.
Sometimes the research comes at the end, when those gaps you've put off must be filled. (I tend to put a series of x's as a placeholder for a description or scene I'll fill in later because I don't want to do the research as I'm writing.)
Research has never been easier since the interwebs have come along and Google is a writer's best friend. But there are times when Google may not be good enough. A Google search may not find the primary sources you need. Or you come up against a paywall to a subscription database. Lucky for you, libraries often pay for those expensive subscription databases.
Here's a short list of some useful databases:
Ancestry: You've probably heard of this genealogy database with census, military, and other historical records. What you may not know is that many libraries offer access to all this information for just a library card. Great for historical writers.
Freegal: If you like to create playlists for your characters, then you should check out Freegal. Freedown music downloads from Sony Music's catalog.
Foundation Grants to Individuals: Maybe there's a conference you can't afford to attend. Maybe you want to visit the place you're writing about. This database will help you find grants you qualify for.
MasterfileComplete: Thousands of magazine and journal articles are available to access. Perfect for the nonfiction writer.
Novelist: This is the go-to database librarians use to find authors and their works, and more importantly, read-alikes of authors and their works. When a patron comes to the desk and says, "I've read all the Sookie Stackhouse books. What else have you got?" ... that's when I go to Novelist and find other authors the patron may like. This is a fantastic tool for writers writing query letters and looking for books similar to their own. It's also good for writers looking to research a particular genre.
Oxford English Dictionary: The complete 20 volume set of the OED would set you back over $1200. You can get it for free on a library database.
These databases are the ones I thought would most benefit writers, but there are other excellent databases for everyday life. Consumer Health Complete for medical journals, Mango Languages to learn a foreign language, Auto Repair Reference Center for DIY auto repair.
Check your local library to see what databases are available!