Perhaps you have accidentally put your Player Characters against an enemy that’s too big a challenge for them, the dice are just trying to kill them, or your players are making very dumb decisions. Fear not: The odds may be against them but you, the GM, is (secretly) on their side. Remember you can do anything… you just need to make it believable.
Keep a cool demeanor and pretend everything is going as expected, even if it has totally fallen apart. Pretend you’d love to kill all their characters (even if it’s your worst nightmare); it will keep them on their toes. When you save them from certain death they will feel like heroes who just beat the odds. They will never realise that you are actually the hero (but that is as it should be).
Here are a few suggestions on how to save the PCs from certain death: