One strategy I'd suggest early on (especially when designing a "climactic" encounter near an adventure's end) is to design a scenario where the foes arrive over time. Either there are reinforcements on the way, or some of the enemy are tied up elsewhere (fighting someone else, doing evil deeds, etcetera).
The advantage is you can modify the numbers, without the players noticing and if they're waltzing through the finale - more or tougher reinforcements turn up. If they're getting creamed, perhaps the reinforcements never arrive or arrived wounded/depleted in some way.
This allows you to fudge things on the fly without it being obvious to players. I have been in the situation, as a player, of entering the final battle - getting creamed for a few rounds, then suddenly the bad guys start "rolling really badly" and we sit there for rounds and rounds, near death's door while hardly getting hit as we chip away at the initially overpowered mastermind.