I linked to this answer in a 5e question, attempting to bring support for the idea that, if you cast an open-ended spell, like Magic Mouth, it could remain after you die. Someone pointed out that, as a Pathfinder question, it wasn't relevant. Is there evidence for this idea in 5e?
1 Answer
Spells that require concentration end when you die. Aside from that, a spell has to specify that it ends when you die for this to be the case. First up, we have the base duration rules:
A spell’s duration is the length of time the spell persists. A duration can be expressed in rounds, minutes, hours, or even years. Some spells specify that their effects last until the spells are dispelled or destroyed.
Nothing in there about the caster dying. Spells in this category last however long they say they last.
Next up, instantaneous spells:
Many spells are instantaneous. The spell harms, heals, creates, or alters a creature or an object in a way that can’t be dispelled, because its magic exists only for an instant.
Obviously in this case the question is irrelevant; the caster is alive when they cast the spell, and even if they die straight afterwards (for example, if they fireball themselves :P), an instantaneous spell is already over.
Finally, we have concentration spells.
Some spells require you to maintain concentration in order to keep their magic active. If you lose concentration, such a spell ends.
There are a number of ways to lose concentration, but the important one for our purposes is:
Being incapacitated or killed. You lose concentration on a spell if you are incapacitated or if you die.
So of the basic types of spell durations, only spells that require concentration will end on death.
That said, spells can have their own rules. If a spell specifies a condition that will end it in its description, that condition will end it. For example, take death ward:
If the spell is still in effect when the target is subjected to an effect that would kill it instantaneously without dealing damage, that effect is instead negated against the target, and the spell ends.
So if you cast death ward on yourself, then get targeted with an instant death effect, the spell will end. Obviously, this isn't exactly the same as the spell ending because the caster died, but it illustrates the principle of spells having their own rules.