This question and Does a PC who was KO'd earn experience for that combat? are sort of duplicates in that logically they must have the same answer. Either, characters who don't finish the fight are included in all XP calculation, they aren't included in XP calculations, or they only get XP for the monsters in the fight that died while they were actively engaged in combat.
The answer, as I see it is that XP gets divided among all characters who contributed helped in the fight. Here's why:
Death The Ultimate Experience
The death could have been caused by a player choice. If a character threw themselves at a danger to save another party member or the whole party, didn't they learn some big lessons that we should reward players for? The Character learned self-sacrifice, the player exercised roleplay, and the story just got a whole lot more interesting.
Even if the death wasn't a big heroic moment, but a Leroy Jenkins charge, then the player and character both (hopefully) learned a lot about making wiser choices.
The player presumably damaged the enemies and helped in the fight, no matter how briefly, and that decreased the difficulty of the encounter for the other players, and XP totals should reflect that. I suppose if it was a Leroy moment, and they didn't get a single hit in against the enemies, maybe the XP should split among the living, but otherwise no.
I don't see much to be gained by denying the dead player one encounter's worth of XP earned. The player will already be behind because the party will likely face other things before they can get the dead player resurrected (at least at lower levels). The lopsidedness can be interesting unless it gets too lopsided, at which point the player who died, being miles behind the rest of the party, will begin to feel useless.
The rules are ambiguous. They read only:
When the adventures defeat ... monsters ... they divide ... XP ... among themselves. (DMG 260)
It isn't clear from that what the intent was. There is no ruling from Jermey Crawford about fallen heroes XP. The only thing we have to tell the designers' intentions is this tweet from Chris Perkins who wrote the big adventure modules like Curse of Strahd and Tomb of Annihilation. So, this isn't a official rules stance of WoTC, but his answer was:
Only if the characters directly contributed (for example, by goading the enemy to cast the spell). #WOTCstaff (https://twitter.com/ChrisPerkinsDnD/status/757940391849013248)
So, if a character contributed at all they are calculated into that division. If 4 adventures fight a dragon and 1 dies, you still divide the XP 4 ways. Each getting 1/4 of the encounter's XP.
Odd Incentive Otherwise
An odd incentive arises if you don't divide the XP among even the fallen. You create a situation where near the end of the encounter, a party member killing or letting die another party member to gain 1/nth more XP (where n is the number of party members who entered the encounter) to split among the remaining.
Think about it: the dragon is almost dead, and so is the barbarian that is right up against the dragon. The wizard's player thinks ("I can take out both of them with a fireball, and the party will split the barbarian's XP and the dragon's hoard. Sure!"), as opposed to thinking "How can a lay down a fireball so that I don't hurt my party? Or at least doing as little collateral damage as possible?"