When a character dies (and we mean fully die, death saves, the whole 9 yards) during an encounter, their player has to sit out the rest of the encounter, but is allowed to continue with that character for the rest of the session, with penalties. These penalties include: missing out on the dragon coin bonus awarded at the end of the session, losing any gold accumulated during the session, and experience points for the session. Also, your party as a whole will take a dragon coin bonus penalty and aren't allowed to loot your temporarily deceased corpse, so it's in their best interest to keep the entire party hale and whole. In the event of a TPK, which is disheartening even during home games, players may experience one of several possible outcomes. The context of the TPK is very important. While we do allow friendly fire, fireballing your party to roast some mind flayer calamari will result in the pyro-passionate player losing a Dragon Coin Bonus in lieu of their teammates. Cooperative play and team effort will always be rewarded over selfish completionism. If a TPK occurs because that's the way the dice fell, yes, the typical dragon coin bonus would be removed like when a PC typically dies as will the EXP and gold. However, any sort of resurrection magic completed before a short or long rest (or the end of the game if that's how far along you are) is considered a way to bypass any penalties.