When I first started seriously writing, I had this brilliant idea. I wanted to write a quest for the holy grail, and off I went.
I did research. I took writing classes to sharpen my craft. I read books on writing. In the end, I let the story carry me away, and boy, did it ever.
Research can take you down all sorts of rabbit holes. While I was learning, I learned MORE interesting things, things I wanted to incorporate into the story. As a result, early versions of that novel were quite scattered, even if what I was learning and trying to convey was So Interesting. But it became a runaway horse. The story got too big and got away from me.
I went back to the craft books and learned about theme. Focus. What's this story about?
Theme
First off, you need to figure out what your story is. Every chapter should move the story forward, one step at a time and not wander off the path.
A well-known author I've read wrote several books where she liked to show off her research. It dragged the pace way down, and ultimately, I was interested in what she showed, but I would have appreciated her more if it had been presented in a separate book addressing a different theme. There was literally a third of the book that wandered away from the theme to provide the background/history - like "100 years ago..." That deserved its own book. As she wrote it (and it was a voluminous tome) it distracted me from what was happening in THIS book. Theme.
I learned about theme writing my first book. In my "quest for the holy grail," I ran across different interpretations of what the holy grail actually is. Then I discovered different aspects to those interpretations. They are wide and varied, and some are quite interesting, but rather than speculate in my story about all those variations, I needed to focus on one. The history surrounding all the players was fascinating, but is it relevant to what I'm writing? Choose what you want to portray and stick with it. For instance, Knights Templar. I learned so much about them and wanted so badly to use all that I'd learned, but none of it related to my character or her quest. The only thing that mattered was one of the secondary characters (well, two) continued the traditions. It wasn't about them. Avoid things that distract your reader from where you're taking the story.
Moving the story forward - goals, motivation and conflict
While I was writing, I'd been hoping to write something to rival Indiana Jones. In the end, that's not my area of expertise. I grew up reading romance and horror (odd combination, I know, but it is what it is). My story developed as a romance, with part of the reason being I didn't know what to do with the grail once I found it. Stick it in a storage room, like Indiana Jones? I think not. I suppose I could have written a whole series on a grail keeper and their adventures, but again, that isn't my strong suit. My story turned into a romance, with the grail quest as the theme. My character's goal was to find the grail. Part of the conflict was "does it really exist?" Her motivation was to do something for herself. Chase her dreams. Fulfill her father's wishes for her. Everything she does is in pursuit of that goal, until the romance derails her. More conflict. She has to break rules to pursue her goal. More conflict. The point here is it sticks to the theme. In this case, the grail quest, and not all the possibilities. Even if the goal changes, don't lose sight of the focal point - the theme.
Figure out which details are important and which ones aren't
Again, using my quest for knowledge as the example, my scattershot approach produced lots of avenues that didn't move things forward. They didn't add to the story, but rather distracted from it. With that being said, I was able to include some of those peripheral ideas in my example. My main character is on a quest for the grail. It only makes sense she's not the only one. All the research I did helped me determine which details I could use and forced me to consider which things to cut. Indiana Jones was in competition with the Nazis. My character is in competition with religious zealots - some of those folks that turned up in my peripheral research. I was able to use some of that peripheral research and turn it into important details that all came together to tie my theme up. There are those who pursue the grail for "good" and there are those who pursue the grail for "evil" or greed. Waxing poetic on the details for what powers the grail might originally have possessed are also side quests. What's relevant is whether any of those show up in this story. Speculation detracts.
Other miscellaneous details. I learned about the region my character was visiting. The vegetation. The population. The culture. Things that are unique to that part of the world. It helps to add "color," although not everything is pertinent to the story. I was able to incorporate certain details that highlight the theme. Some of those details were "oh, that's interesting" but didn't have a place in the story.
At the end of the day, your story has to have focus. A beginning, a middle, and an end. Set the stage for your story at the beginning. Is there an inciting incident? Something that spurs the character on? As they are spurred on, what obstacles do they encounter along the way? Everything should move toward a climax, when that goal is achieved, or changed, or "all is lost." From there, it should move toward a resolution. All of this should tie into your theme. If I want to explain all about the Knights Templar along the way, even if they're related, those Knights need to have a reason to be in the story. Or if I discovered the grail had magical properties, the divine miracles that happened when it was first "blessed," telling that story probably isn't relative to the present quest.
Theme is important. It keeps your reader focused and provides a more satisfying reading experience.