I'm writing a campaign for 3.5 at the moment and, as a new DM, it's been hard for me to decide what I need to write now, and what I'll need to write later. Because it's going to be my first campaign and I'm not sure what will be important when the first game comes around, I've been starting to plan a lot of insignificant details now, instead of focusing on the main story. I know that I can do all of it later or when it comes up in-game, but the thought of having to make up random information on the fly makes me very nervous. I'd really appreciate help with this, because I would love to run a campaign and this is the one thing stopping me from actually doing it.
What I prepare in advance:
What I prepare while I go
What I do not prepare
Specific Dialog, except for the intro monolog for any campaign/session (and it's usually somewhere around a paragraph or less).
My perspective as a screenwriter
Campaign stories are different, a traditional narrative due to the story focusing on more than 1 main character and the interactive nature of the medium. Regardless, many of the tools and tricks I learned while studying writing for my undergrad can be applied to writing campaigns and world backgrounds.
Build the bones first
The bones or skeleton of any story are the major plot points that need to happen and the overall arc of the story. What are some of the important events and decisions you want to put before your players? How do you want the story to begin? What should the climax of the campaign be? By deciding on and writing the major events first, rather than working forward chronologically from the beginning you pick the events that will most shape the story and the go back and fill-in-the-blanks/connect-the-dots between major story points.
A story is only as good as it's villain(s)
Creating a believable, powerful, and engaging antagonist(s) for the party to face down time and time again can really set the tone for a campaign. The best villains are not only foils for the heroes, but directly challenge everything they believe in. A villain should have believable motivations and even be capable of generating some sympathy from the players. For example, in The Lord of the Rings, Sauron is arguably the overall villain of the books, but Saruman is much more engaging because he is a fallen hero who's corruption and betrayal completely reinforces the themes of the books.
Try to plot ahead (by one adventure/session) what ifs? to major campaign turning points
Your players will make choices, but whether these choices are trivial or world changing is ultimately up to how you structure the story. There should be narrative forks in the road where players much choose between 2 or more options and regardless of their choices there will be consequences good and bad that come of it. Think of it like a family tree where the plot begins at a fixed point, the opening action, but from there on, there are branching pathways that the players can follow.