Assuming you have aging turned on, Sims will eventually die of old age. As they reach old age and become an elder, it is just a matter of time before they kick the bucket. The only way to avoid death from old age is by drinking a Potion of Youth (from the Rewards Store) before your elderly Sim dies. But Sims can expire from other causes besides old age.
If there is a fire nearby, your Sim can catch on fire. If you do not extinguish the flames on the Sim, they will burn to death. This is easily avoidable. Stay away from flames and put out any flames that get on your Sim.
Put out those flames or your Sim may burn to death.
Sims who try to repair electronics and do not have much experience with the Handiness skill risk getting electrocuted. Usually, they get shocked first as a warning. However, if they continue trying to fix the item, they can die from electrocution.
Finally, if you do not feed your Sims, or let them eat on their own, they can die from starvation. This is actually a very difficult way for a Sim to die and you have to put in some effort to get to this result. It takes a few days of no food before your Sim finally starves to death.
When a Sim dies, the Grim Reaper appears and removes the body. He usually hangs around a bit and it can be interesting to watch what he does.
The Grim Reaper has arrived. Apparently he has adopted technology and uses a tablet to keep track of his assignments.