For me it varies wildly based on the any number of circumstances. Who the player is, who the character is, what the particulars of the encounter are, where in the session we are, the nature of the campaign, etc. I've had campaigns with many, many PC "deaths" and other losses (smashed by a hill giant, killed by drider, throat slit by a lizardfolk, possessed by an evil relic, possessed by a more different evil relic and buried alive in an empty well by another PC, eaten by a bullette... and that was all one campaign! In fact, those last four were all the same player...) That was probably my longest lasting campaign, where PCs were mostly mercenaries and had a wildly rotating cast of characters.
On the other hand, I had a pretty long campaign with the same party of PCs for the entire run. It was in Eberron and each PC had was tied directly to the prophecy from pretty early on. I had some ideas on contingencies if any of the PCs died but they ended up never coming up, and I was pretty lenient on PC changes as most of my players were new and still learning the system as they were developing their characters.
I tend to run pretty Narrative-heavy games, and I like to incorporate stuff from PC backstories and events within the game into the story, which tends to dull the narrative impact when the PCs associated with them die unceremoniously (Narratively-interesting deaths, on the other hand, I'm all for). Ultimately I do what has been suggested elsewhere in this thread: work with the player to see what's most the interesting result, narratively or otherwise, of the PC "death" is. I've had PCs "die" and come back unexpectedly as NPCs, had PCs disappear and end up betraying the party (a kenku scout who warned the dignitary they were sent to entreaty that the party was instead being sent to poison them; another PC was a cleric of Dionysus who greeted everyone by offering them wine, you can guess how that ended up working out).
The key thing for those Narrative-heavy, death-light games, which has also been pointed out several times, is that there need to be stakes other than (and ideally worse than) PC death. And then being willing to follow through on triggering those massively negative consequences. And making sure nobody lets the PC forget their failures until they do something to make it right again.
Of course, if I'm running a dungeon-crawl or mercenary campaign with little to no overarching plot continuity, I'll let the dice land where they may. It really all depends on what the expectations of my players are and what the aesthetic goals of the particular campaign are. I don't really think there's a one-size-fits-all approach on how to "best" handle death.
I think the closest thing there might be to that is making sure there's something for your player to do if they die early on in a session. D&D tends to be a big social thing with me and my friends, so I do what I can to avoid excluding someone from play for an extended period of time. But even that might not be a universal issue.