Every book starts as a tiny thought in the author's mind inspired by any number of things. It could be a song, another book, something a co-worker said or did. It might be one thing start to finish or evolve into something entirely different. After that initial beginning comes the research. Some writers research a topic for years and then decide to write about it, or they may be like me and seek out knowledge on the fly.
When I research a wip, I always start by reading other books of the same type I plan on writing. I want to know what sells, how they read, and then decide if I want to be the one to go completely out of the box. I'm almost always waving from outside that box.
That's the fiction side of things for the facts, I hit the library and the internet loops. It is amazingly easy to find doctors, agents, psychics and the like willing to help a writer be accurate in their chosen field.
Once I have my "world" created, I fill it with the characters that drive my story. They can come from any number of places, but usually are either dreamt while I'm sleeping or are instantly born when my computer screen is open. It's my job to make them breathe.
(Happy Veteran's Day!)