In 2 games over the last 2 months I've had 2 TPKs.
Some would consider this a failure. The characters all died? What now?
If you are of the "I'm telling a story about the characters" type of GM yea, you are screwed and your game is a bit hosed up.
But that isn't how I do it. That isn't how you do it either. In any game where character death is not only possible but probable, the game can't be a story. I know I harp on this a lot, but it really frustrates me hearing all these folks talking about "the story".
So all the characters in the BCDH game died off. And it was glorious! Some began praying to Vecna for salvation and became her thralls, others refused. The battle was on. Everyone died OR was no longer a playable PC. What does this mean? That the campaign continues with a new chapter! With those events having unfolded as they did (I really didn't think it would go that way, but hey - players? am I right?) a small cult has become a big cult because they have champions. The 4 characters that 'turned' are now effectively the 4 horsemen of the Rock Apocalypse. The new band of heroes is off to hunt for some weird shit in Barrowmaze (which I'm VERY excited to run). Everyone is down with it.
When it happened, I think this was the first time most of these folks had seen a TPK. They'd all lost a character here and there, but there was some continuity of adventure. This was different. I'm pretty sure (although not entirely sure) that what made it more OK was the intro to the next campaign - their previous actions as players had an impact on the world, and that is pretty awesome.
A TPK isn't just a failure of the adventure, it is an opportunity to change focus - how you as the GM handle it makes a big difference. If all the characters die and you give up and nothing else happens, then it was a boring loss. Make it an epic loss.
In the Sorrow in Haven game everyone knew - THEY KNEW - this dungeon was a deathtrap, a lie, a trick, all bad. Yet they still chose to go in there. A few sessions went by, more and more information about the bigger situation was being presented. They got into a serious situation and weren't entirely sure what to do ... but they could tell no matter what it was going to be bad. And it was. Epically bad! Characters getting stabbed and blasted, curses going nuts, people running away and getting overwhelmed. But here is the important part - everyone had fun.
Everyone had fun with an epic disaster. Because it is just a game! Folks were already talking about their new characters minutes later. Technically they did "resolve" the dungeon, but absolutely not as they had hoped. I had no idea if things were going to go completely sour for the characters, so had to so some quick on-the-fly thinking. Their actions ended up having an effect ON THE CAMPAIGN.
Again - a TPK of heroic adventurers should be dramatic. Not a bunch of 1st level wangers. They are fodder. but a group of seasoned adventurers screwing up like that? Oh you know Shit has got to get Real. So ... Sorrow, the giga-dungeon, the heart of the campaign, is now fully awake. They'll know this soon enough. More importantly though everyone talked about how much fin they had getting their asses handed to them.
Don't misunderstand - these TPKs are not common events. Just happened this way. What I'm trying to get to though is as a GM, don't be afraid of them! Use it as an opportunity to weave your player's actions into the setting and start something new.
That "story" the GM runs isn't that interesting (sorry - it isn't). But the story that the players have about their epic and catastrophic failure? You know that is going to stick around for some time. The emotional impact of losing all the characters, and the players all feeding off each other, is more than the GM can thrown out. That is ok. GMs are only human, and at any given table just one human. The power of a group is stronger. That is why seeing a movie in a theater full of people who are excited to see it is more fun than watching it at home on your phone.