Last week, I wrote about working with success. By leaning into the players' success, you make your campaign more engaging and exciting. When you put your game on rails, you undermine the players' choices and shut down some of the chaos and unpredictability that make RPGs fun.
When it comes to handling sudden, unexpected successes, prep is one of your best tools. By putting some thought into how your game might play out ahead of time, you're ready to respond when the players do something crazy, exciting, and plot destroying.
To start with, always keep in mind how much damage the players might do to your plans. When creating important NPCs, always consider what might happen if that NPC is killed or otherwise rendered impotent.
For NPCs that wield power, remember that nature abhors a vacuum. If a the high priest of Asmodeus meets a sudden, bloody end at the characters' hands, how does the rest of the cult respond? Who seize power? What does the cult do to those who defeat its most powerful figures?
Keeping those questions in mind early keeps you ready to respond when things go off the rails. The more important a character, location, object, or whatever, the greater the repercussions to any sudden change to its status or condition.
It's important to think of your answers more in generalities than specific terms. If you try to be too specific, you can easily end up overwhelming yourself. It's enough to know that, upon the death of the high priest of Asmodeus, the clerics immediately beneath him gather allies and fight to the death for the right to rule. The new high priest might very well send the PCs a gift - a sword forged in Hell or a wand that projects infernal flames - too thank them for paving his path to power.
By thinking in generalities, you can ensure that you can quickly adapt your ideas to suit the specific situation at hand.
Be creative in your answers, seeding them with new adventures and plot twists. In fact, since you'll need to rely on them with things go sideways it's best to make them as easy to convert to the campaign's next adventure as possible.
Think of the dramatic outcome as the starting point of an adventure hook or story, the first act in the next adventure.
With your prep done ahead of time, your campaign can never go in an unexpected direction. By acknowledging that anything can happen, you're ready when it does.