D&D 5E - When you've made the battle too much to handle...
In general, if the situation really is hopeless should the party try for total victory, there are at least three options always available to you as the DM:1. Unexpected "allies" (or at least not-currently-enemies) arrive and save the day. Perhaps they exact a price (whether it be "we are evil and will lord this over you" or "we are good and would appreciate your help in return"), perhaps the PCs are totally incidental--perhaps, like your alu-fiend, these were other enemies of the lich that were simply waiting for a golden opportunity, and the players dropped one right into their lap. The core of the narrative direction here is what do these new actors want? You have created either a mystery hook or an obligation. Depending on your specific choice, it could make the party "important" or simply useful, but either way, it should reveal something significant about the movers and shakers of the world.
2. The party is suddenly, and without explanation in the moment, given great power--enough to easily permit them to finish this enemy. But...as far as they know, that shouldn't have happened. This creates a different kind of mystery hook: how or why did we survive when we should have fallen? This mystery strongly implies that there's something Special about the player characters, but as far as they know there isn't anything THAT special about them. Where you choose to take it from there is up to you. Perhaps this leads to the reveal that someone (good or evil) has been Watching them and wasn't ready to let them go just yet. Perhaps it reveals a secret about who or what they are. Perhaps they discover that powers like this aren't unique to them....and that that is a serious problem for the world. Etc. Whatever happens, this is pretty high on the Serious Implications meter. It also allows you to defer making a firm decision for the longest time, since you can be just as in the dark as the players are about what caused this!
3. The lich (as others have mentioned above) decides that these foolish fools who dared to stand against him might, despite their unbelievable hubris, actually have SOME uses if kept alive. They don't die at 0 HP, and you never ask them to roll death saves (ignoring any death saves that may already have been rolled)--because the lich isn't attacking to kill, he's attacking to subdue. They wake up and the lich does the usual dramatic villain thing, and then offers them freedom if they just take care of a few simple errands for him. "Oh, nothing that would offend your delicate hero sensibilities, I assure you. Just a few odds and ends, things that are...shall we say, awkward for one of my...necromantic investments to undertake." This can be a serious offer, or a false one in any number of directions; perhaps the lich intends to double-cross them, or maybe just intends to always put them just a little bit deeper in his debt with every successful job, so they can never truly escape. This makes the problem extremely personal, strictly between this villain and this party. It's much more down-to-earth, but requires that the players believe that the lich would actually want to employ them.
More or less, if the system indicates unavoidable defeat, you must change the parameters of the situation. Option 1 alters the battle itself; option 2, the heroes; and option 3, the opponent's willingness to fight to the death. Regardless of whether you choose these or some other option, you'll have to choose something that changes the input, otherwise the output remains exactly what it was.
Problem with Toll the Dead (and Sacred Flame) is that the players must make a save so the DC can't fudge the roll behind a DM-screen. That means that you have a combat where (practically) all rolls are made in the open. Any DM that does that in a deadly encounter risks a TPK, as the dice may just fall in the wrong direction.
I never roll anything secretly--at least, not in terms of "do people succeed/fail" at things.* Fudging is never necessary for avoiding TPKs. You just have to be willing to use other methods, like those outlined above--stuff that inserts new things into the fiction, rather than deceiving your players about how the system actually works.*I occasionally roll secretly for things that don't actually matter if the players know, e.g. "I'm checking a table for which random room you appear in; whether or not you know the result of the die does not, in any meaningful way, inform the players about what will happen. It does determine it, but there's nothing the players could possibly do to affect the number, and even if they see "6" or whatever, that means nothing to them unless they also have the table I'm using to consult the result.
ncG1vNJzZmivp6x7prrWqKmlnF6kv6h706GpnpmUqHy4tMSnZLKnpauybrnAnZxmrJiaeqOt062jnmWkpLxuudScn2asn2K1orrDpZxnbmhrgnF%2Bjg%3D%3D