Moderators can set themselves to "away" in the moderator dashboard (a page only available to moderators):
This is an easy way of letting the rest of your moderator team (and SE) know that you won't be active for a while. I have used this at times when I was on holiday and wouldn't be moderating much and once when I had had an accident and was in bed with a broken leg.
Now, of course this isn't something that can be done posthumously, since if I am dead I will have some technical problems preventing me from accessing that page. However, I think the chances of a moderator dying on the job are so low that we don't need something special for this. The normal mechanisms for dealing with inactive moderators will suffice.
These mechanisms are simply that SE will periodically check in with any moderator who hasn't been active for a while. If the moderator doesn't respond to queries, eventually their diamond is removed and, if needed, a new election is held by the moderator's community.
All sites are supposed to have multiple mods so that the absence of any one moderator is not a big deal and doesn't affect the efficacy of moderation on the site. In all the mod teams I am familiar with (I have at different times been a mod on three sites), there are mods who are more active and mods who are less active. That's fine, the system is set up to handle that.
If the family of a deceased moderator wants to, they can of course inform SE, but that is entirely up to the family and they will presumably have more important things to deal with than some online community that their deceased loved one was involved in. This means that it is theoretically possible that a mod may pass away and we never know about it, but that's just the way it is. We obviously cannot start badgering the mod's family for details, after all.