I hope not to start any insult-slinging here.
A lot of the time, I don't plan. Last session, I walked past an interesting-looking hospital two hours before the game, memorized it's vague layout, drew a map and decided where the key locations were, and came up with the general assortment of who the bad guys were.
The players were supposed to stop a group from sneaking into the palace/hospital, and I kept throwing a few random distractions at them to lure them away from where the main group was sneaking in. Eventually, though, they saw through the tricks of the NPCs, rushed down to where the infiltrators were on their way to, and set up an antimagic field.
The fight started as soon as the first invisible infiltrator stepped into the field. They started a barrage of spell-slinging and hacking and slashing, and though I really wanted the climactic fight to take place a few rooms down where there were all sorts of nifty tricks available, I did the best with what I could in the bare room the PCs had chosen to lay their ambush in. I hadn't come up with stats ahead of time, but I had the DMG open with some sheets of paper in it in my lap so I could scribble notes as things went on.
As the fight progressed, the antimagic field eventually went down so that the PCs could use their own magic, and then I decided that the fight would quickly end if one PC's mass confusion effect hit all the villains. The NPCs rolled low on their saves, but, honestly, I don't know what their Will saves were; I didn't write them down before the session began. I just decided that I wanted the NPC mage who was leading the group to get a few more licks in before going down, so I said she'd made her save just barely, while the rest of the NPCs were running around confused.
They ended up cornering the mage in a small part of the room so she couldn't use any area of effect spells, and they cut her down as she desperately tried, and failed, to get off a few spells. The players who took her down are fond of ripping villains apart, so I think they enjoyed hacking her to pieces in person more than letting her wander around confused while they took potshots at her.
. . .
On a different example, with the cavalry, think of it this way. The DM, John Tolkien, wants to really scare the PCs, and make them see that the villains are probably too powerful, so he throws an army of hundreds of thousands of Orcs at them while the PCs defend a fortress. He's pretty sure the PCs will think of something crazy to save the day, like Gandalf's player did a few weeks earlier when he dropped the balrog down the pit, or like what Boromir's player did when the Orcs just couldn't deal the last few hit points to him after he'd been struck with three critical hits on arrows.
Unfortunately, the players just hang back in the fortress and hack at the monsters for a 30-minute slugfest, and John the DM realizes they're going to lose at this rate. He fakes that he has a stomach cramp, and excuses himself for a minute to go to the bathroom, telling Aragorn's player to doublecheck the math on Legolas's attack bonuses for dual-wielding. While in the bathroom, John washes his hands and splashes some water on his face, brainstorming what to do. Then he remembers that the party had been very friendly to the horsemen of Rohan a few sessions ago, and they'd expressed condolences about them getting kicked out by their crazed king. Inspired, John decides that the tide of the battle will turn when the riders come in from behind and catch the Orcs off guard.
The battle ends up taking another two hours, but at the end, the Orcish army is scattered, and the PCs are weary, but victorious. The PCs have had lots of close scrapes like this, and though they might wonder if perhaps the Rohirim coming in at the last minute was off the top of John's head, it fits with the story, and it made for a cool scene, so they're okay with it.
John, though, makes a mental note not to have any allies come to their rescue for a good long time. They fought well this time, but he wants their next victory to be uniquely theirs.
And you, reading the novelization or watching the movie, probably wouldn't criticize Tolkien for copping out and having allies help the heroes. It was a cool movie, and that's what matters.