The ways Sims Die:
Sims who grow old are going to die unless you take measures to prevent this type of death. Just how long they have depends upon the game's lifespan settings. You can check their age by pressing 'Y' to view the Simology tab. When the bar is full, your Sim could die at any time. You can prevent Sims dying of old age by purchasing the Potion of Youth for 1500 Satisfaction Points. This is fairly sustainable, so long as you continually complete Aspirations and Whims. The earlier in life you take it, the more time there is to get another 1500 to prevent it again.
Death by Fire
Sims can die in fires started by the Stove, Electronics, or a Rocket Ship Crash. While you cannot install them outdoors to stop a rocket ship from causing death, you can indeed put Sprinklers in your home. There is no Fireman or means of calling when there is a fire in The Sims 4 at time of writing. You must either use an Extinguisher or activate the home's Sprinkler system (under Alarms). One control panel that can protect a single-story home. If there are any fire hazards on the upper levels, use a second box to help protect the home. The sprinklers are installed so long as you have a roof.
If your Sim catches fire, just click them and choose 'Extinguish'. They can put themselves out with some nice fire extinguisher moves. You can likely have another Sim help as well. You may also run for the shower. There is a timer before the death, which is visible via a moodlet, so you DO have time to do something about it.
Death by Drowning
Continue swimming once a Sim has become exhausted, and they'll eventually die. This is normally not a problem, given Sims will get out and head toward a bed. If you're controlling them on fast forward, they can easily drown. Use pools when your Sim is in good condition and avoid this death, easily.
Death by Starvation
Sims can starve to death if the hunger need is not met, and it's entirely preventable. Simply eat. It takes a couple of days to starve a Sim, and they'll be practically non-functioning until you get them some food