I wing most of what I do, almost always. I create a scenario -- something to present to the PCs -- and then let them run with it. I keep copious amounts of notes in terms of what I tell people so that I don't contradict myself, and then release them on it.
I never really script it out -- this leads to this leads to this -- because that way lies the choochooing. I will create...building blocks is a good way to put it. X, Y, and Z are true. A, B, and C will happen if 1, 2, or 3 happens. If not interfered with, the goal of these NPCs is R, and I get a general idea of how they're going to pursue their goals. Sometimes this means the PCs snuff things out almost immediately, and sometimes this means the bad guy has time to build the army on the borders and invade their hometown and oh boy the whole game just changed.
Mostly, you have to be flexible, and you have to adapt to what signals your players are giving you. If they ALL start looking in closets, because they are all interested in seeing what's in the closets...well, now your plot had best start involving closets, because they've told you loud and clear that's what they want. If they keep going out and picking fights, they want a fitey game. The goal is fun, for you and for them, so you drill in on what they seem to be interested in.
Don't plan what they're going to do. Don't ever, ever, ever plan what they're going to do, or hinge plots on the PCs doing something in specific unless you're prepared to outright tell them somehow what that specific thing is. In my recent case example in my OTT game, the PCs had two strict conditions that HAD to be met for anything at all to make sense. They had some difficulty figuring it out, so eventually one of the NPCs outright told them: this is what we're waiting for. I try really really hard to avoid hanging progression on folks doing/not doing something specific, just doing something. If it'll work, let it work. If it doesn't, it doesn't.
If the players blow up your entire plot through a clever use of a power or something...let them. Get a new plot.