So, one of your players makes a risky move, the dice gods disapprove, and their PC dies. For one reason or another, no one in the party is able to revive the PC.
I'll start by saying the worst thing you can do, IMO, is have the player just sit there until the end of the session, and I think most GMs understand that.
I give my players a couple of options:
Take a few minutes to roll up a character, and jump in. (Since they had to do it on the fly, I let them change things after the session when they've had time to really think about the new PC)
Play the monster(s) that the other PCs will face, and roll up a new character at home for the next session (at the same level that the rest of the party is at)
Play an NPC if one is available and has more than a bit part.
Go home, and bring a new character in for the next session.
When the player rolls up a new character in this situation, I just assume that the new PC has always been part of the party from day one, and the game continues as normal.
I once had a PC that died, and the DM wouldn't let me play until I could figure out an in game reason for the new PC joining the party (and that also he had to review and approve). IMO, that's not fun, and really unnecessary.
So, with all that being said, what do you do?
Let's first clarify that there's a difference between dying in the middle of a
battle, and more generally die mid-way during a gaming night. If it happens during combat, I see no big deal in the player being out of the action until the battle is over (which doesn't mean they can't watch the game and interact by giving input and suggestions). After all the same thing happens in lots of games. Only very long combat encounters that last the whole evening will be problematic.
My usual premise is that I don't normally let a PC die for good unless its player is fine with it, so even when the rest of the party cannot revive it yet, it doesn't mean the PC
has to be replaced by a new one. With that in mind, there is no rush to create another character for that player. In any case, I do not like stopping the session to let the player roll up another PC while the rest of the group waits, but I also do not like letting the others continue while said player is sent away to create their PC and maybe even rushed into doing it. I just think that character creation is too important for a lot of players so they should not be rushed into it, and the best way to create a character that is supposed to last long is either
between gaming sessions, or within the first session when everybody does it at the same time. That said, if you're the kind of player that consumes PCs like peanuts and always rolls up another on the spot, go ahead...
once. I still don't like having you jump into the party in the middle of a quest, so if I get the feeling you're damaging the overall credibility of the story because you're recklessly losing PCs too often, I'll send you to another gaming group (or organize a Tomb of Horror styled campaign where everyone will play like that).
That leaves me with my favorite option: let the player roleplay some NPC and monsters.
Obviously, I wouldn't want to reveal much of the plot to the player, but that is not necessary if you choose relatively unimportant NPCs. Playing monsters in combat encounters is also very story-safe most of the times, and IMXP players always have a lot of fun trying to "use" the monsters stats.