RAW doesn't say much about it other than:
Typically, XP is awarded for defeating the monster, although the DM may also award XP for neutralizing the threat posed by the monster in some other manner.
How to reward XP is usually handled by the adventure paths themselves. Some are very clear on how much XP to reward for what.
So let's take a look at the (more strict) adventure league rules:
Experience Points (XP). Award XP as noted at the conclusion of the adventure. If you’re running one of the adventures published by Wizards of the Coast, it is up to you to calculate XP for your players. Otherwise, you’ll be provided with a guide on how to do that in a standalone D&D Adventurers League adventure.
As you can see, it pretty much refers to the adventures themselves too rather than giving a general guideline. Or says it is up to the DM how to calculate it if not defined by the adventure.
Interesting is the part about PC death:
- If the character can be revived by paying the cost: Get all XP from session
- If the character uses faction charity to be revived: "Forfeits all XP and rewards for that session (even those earned prior to death during that session)"
- If the character cannot be revived at all: Restart from level 1
------------------------------
So much for RAW.
I personally equally share XP between all characters that participated in combat. If someone exits combat mid-way (run away, die), then he doesn't get the XP from then on anymore, but still gets the XP from what happened before. If he however can't be revived at all, then the player will have to create a new PC that typically starts at 900 XP in my games. In that case, the surviving PCs actually get his share of XP for the battle instead.