Getting a book out into the world can be a long, difficult process. To give a sense of what it can take, here's the life cycle of Rebel Mechanics, my book that was published this week:
Fall 2009: I came up with a story idea that mixed steampunk and fantasy in a technology vs. magic situation. I started reading as much in the genre as I could find and began doing research on the time period and the technology.
Late winter/early spring 2010: I'd more or less figured out my main plot and characters, inspired in part by a trip to an antique show where I bought some old photos that caught my eye.
Summer 2010: I decided I was definitely going to write this book and began researching in earnest.
Late August/early September 2010: I wrote a proposal -- about three chapters and a synopsis -- and sent it to my agent.
November 2010: My agent submitted the proposal to fantasy publishers. I kept writing the book and completed a draft.
Early 2011: The responses from the fantasy publishers weren't encouraging. Some thought there was too much romance and suggested I try romance publishers. Some wanted more magic. Some wanted less. My agent and I discussed options. I read some similar fantasy/romance series and decided that wasn't where I wanted to go with it. I suggested targeting the young adult market, since the characters were young and it's essentially a coming-of-age story. In YA, they don't really divide by genre so I wouldn't get caught in that romance vs. fantasy bind.
Spring/early summer 2011: I revised the book to emphasize the YA elements and tighten the pacing.
Summer 2011-spring 2012: I went through several rounds of revisions with my agent to fine-tune the book for the YA market (while writing another book in the meantime).
Summer 2012: My agent submitted the book to YA publishers. There were a few "almost but not quite" responses. Oddly, the more genre-oriented publishers thought it was too "literary."
Fall 2012: My agent and I decided not to give up, and my agent submitted to another round of publishers, including some of the more literary ones.
February 2013: Farrar, Straus & Giroux bought the book. (Yay!!!)
Fall 2013-Spring 2014: I went through several rounds of revisions with my editor.
Early summer 2014: I got copyedits on the book and did another round of revising based on the editor's suggestions.
August 2014: I got the cover art.
Fall 2014-Winter 2015: I went through a few rounds of page proofs, making my own corrections and responding to questions and suggestions raised by the proofreaders, then checking to make sure the corrections were made properly without introducing new errors.
Early 2015: advance copies started going out to librarians and booksellers
July 14, 2015: the book was published
Most books don't take this long between idea and publication, but it can take that long. The delays here came in reworking the book after the first round of submissions, with multiple rounds of revision (while also writing other books), and in a publisher with a small enough list that the book was scheduled for publication more than two years after it was bought. I'll admit that I came close to snapping at the fourth or so round of revisions with the editor, since I'd been working on the book for about five years at that point and was on about my tenth draft. Still, every round made the book a bit better.
The key thing to note is that publishing doesn't happen overnight, and the work isn't nearly done when you finish writing the book.