I really enjoyed this play report over at Dreams in the Lichhouse.
Checking in on Chult - Fane of the Night Serpent
My PCs definitely know how to cut their losses and run. His did not, and chose to fight just a bit too long to escape.
But this also illustrates an important thing - you don't have to end a combat loss with a TPK. And PCs who make a fight either a TPK or a victory, with do-or-die tactics and characters who can't be captured until they're dead, take away an important way to keep the adventure going forward. That is, capture.
This could easily have been a TPK and a campaign ender, as it would have been tough to start back over with new PCs and finish the job of the existing PCs. Instead, the enemy captured them for nefarious purposes and found that they have some common goals. The PCs sure as heck aren't going to benefit as much as if they'd won (best case), or just come and negotiated to help (second best case). But third best case is better than a TPK, which was the other remaining option.
I wrote a whole article back for Pyramid 2.0 that dealt with this. I wish those were up online for linking. But in any case, this is a good example. Don't let the campaign end just because the PCs lose. And PCs, don't bet the farm on victory against all odds . . . but don't give up trying to improve your situation when you've lost. By all means don't pretend to be negotiating from strength you both know you don't have . . . but do offer up what you've got. And GMs, remember to negotiate as the NPCs, not as you. They may see an asset where you're just frustrated by your players (or gloating over their erroneous ways.)
This is basically a bad error on the part of the players turning into a whole new spin on the adventure, not an end of the adventure. Great stuff to read!