There are ways around death, even after the death occurs. Not all these tricks will work with all types of deaths.
The Grim Reaper
The "Living Large" expansion packs adds the Grim Reaper. He is a non-playable character (or NPC) that appears when a Sim dies. Family members can plead for the Sim's life by playing a game against the Grim Reaper. There is a 50% chance you'll win. If you do lose, there is still a chance the Grim Reaper will decide against taking the Sim's life.
You can revive your Sim from death with the move_object cheat. To use the code enter cheat mode (ctrl - shift - c), type move_object on. Click the Grim Reaper and then press delete, do the same for the dead Sim. The Sim's icon should now have a crosshairs on it. Click the icon, and the Sim will appear on the screen.
This seems obvious, but in a panic you may forget. If a Sim dies and you didn't want it to happen, don't save the game! Just exit the game instead. Another reason to save often.