The answer to "How often should a game see a PC die" and "How often should there be a TPK" is the same.
"As often as the players and [randomness of the] dice make it so."
Death is a real risk of the game and real consequence of PC in-/action. The players understand that from the word go. They are the crafters of the story that will be getting told, through their characters' actions. If their actions lead to a "no win situation", by whatever path (as many have already been detailed): poor planning, not realizing/underestimating the strength/danger of the threat/challenge, refusing to retreat when it becomes obvious/necessary/prudent, and (more outside the control of the players or DM) mitigated by the randomness of the dice rolls, whether poor rolls for the players or particularly good ones for the DM, can all lead to a character and/or total party death.
I, as DM, am not "out to get/kill" the PCs. But through story or chance, it happens/can happen. The players understand that and, also as others have already noted, it adds to the excitement and challenge of the game
to know that.
A game in which no one
can die (other than through some kind of "story fiat" and/or player desire) is not a game in which I have any desire in participating. There is no challenge in "plot immunity" (or whatever that term is for untouchable PCs).
As to the second part of the questions posed, and they are not really necessarily linked to my mind, "How easy and/or costly is it to reverse death?" that is a case-by-case basis.
In my campaign setting, I have a detailed pantheon and use a kind of 2e-ish "clerical spheres of magic" breakdown for my clerics. So, there are...3?...goddess of Life/Healing/Fortitude, goddess of Death/Prophecy/Judge of Souls, and supreme "King of the Gods" god of good/light/all that jazz (4! If you count the Elder god of Evil who will bring folks back to serve them). Yeah, only 3 possible deities that gain access to
Raise Dead in the first place. There would be several others that could use
Revivify. So that's one hurdle, is there a cleric around that could cast it in the first place.
The second is finding/being in a location that has a priest/-ess of sufficient level to use one of those spells.
The third, more story-driven/player's choice, is the goddess of Death going to
allow you to return and under what circumstances [Is the tapestry of your life complete? Has the candle of your soul burned completely down/out?]?
As for other means: a rejuvenating fountain, portal to/from the afterlife, breaking into the wealthy noble's estate who is reputed to have an Elixir of Life (or Spell Scroll of Raise Dead), etc... those are/become available as the players decide/need. If a quest to bring back Doldo the Dwarf is agreed upon by the players/PCs, then that's what they're going to do. Lots of research. Hunt down leads. Finally go on the quest for the Macguffin of Soul Retrieval that will "circumvent" the goddess of Death's wishes/power (not a great plan

). So be it.
Quick aside, it used to be part of the "Standard Operating Procedures" of our parties, in 1-2e days, that as part of the adventuring "company" you were contractually obligated to bring back slain PCs (and/or give them proper burial if it was not possible/player didn't want to). Since most deaths were not by the player's choice, going about the business/expense of bringing folks back to life was often a source of adventure for a session or more...at least until a party was capable of doing it themselves.
So, it is certainly not a given/easy (unless the party happen to mbe in a large city with a significant enough temple to house such an individual). As for cost. I generally do a standard 5,000 gp (in "donation" to the temple). But, of course, many a tale of daring-do have begun on the quest promised/traded to a temple or deity in exchange for the ritual...particularly to return lower leveled PCs.
But returning from death is not always a desired option and is, ultimately, player's choice. Does the soul/character, after experiencing their afterlife [good or ill]
want to come back? It's the player's decision.
I have had players (more than one over the years) who simply want to change their character. They want to play something else. They get bored cuz they hit a certain level and nothing feels like a challenge anymore. The spellcasters seem to be having "more fun." The elf PCs are always [
seem to be] saving the day, so they want to ditch their dwarf for an elf. The party's in a new place/environment [and will be there a while] and they have an idea/concept to play someone from that locale. There are loads of others, I'm sure.
This can be accomplished by any number of "in-game reasons" (and I often try/prefer to make sure it is, rather than just "I [the Player] wanna kill them off"): the PC decides its time to "retire"/the last battle was "too close a call." The PC gets called away on a more important mission. The PC is swept away in a magical tornado/vortex/puff of cloud and noone really knows what happened to them, etc... I've had one (at least, that I remember) particularly impatient player have their PC commit suicide -walked off an impossibly high cliff. Just walked off...- since she didn't want to "wait" for the story exit of her PC (and was all pouty the whole -I think it was about 15-30 minutes, no longer than a half hour- waiting for a convenient in-story place to introduce her new one).
In another case, a player was moving away and wanted [their character] to leave the campaign in a "save the day/battle tale for the ages/blaze of glory" rather than just have them wander off into the sunset to [possibly] come back at some undetermined future time (denying me a great NPC for me to use in the world, in the process. grr.).
TPK's are another story and really can't be accomplished without multiple bad [for the party, whichever side of the screen they're on] dice rolls and/or many significantly poor player/character decisions. I haven't really had many, that I can think of. But I certainly wouldn't/won't/don't shy away from it if it happens.
Tangent? What tangent?
So anyway, yes, lethality in game is important...and in my particular case for game enjoyment, as DM or player, necessary. I suppose, if we want to do a [completely arbitrary] scale of "How high/low lethality works for you?"
On a scale of 1-10, with 10 = a TPK every session and 1 = Never/PC plot immunity, I'd be a staunch 6 or 7. If it happens. It happens. My monsters/NPCs are going to act as makes sense. I'm not going to pull punches or fudge rolls...ok, maybe,
very rarely, I might "smudge" dice or story a bit in a PC's favor in the case of some uncannily poor dice/luck. It happens. We've all seen it. I can't, in good conscience, kill off a "beloved" PC because the player's dice have been rolling 1s all night (or mine have been rolling 20s).
I'll do that for a given character once! But I can't/won't "save them" that way in the face of player decisions. You gotta know when it's time to RUN!
But none of those 6 or 7 points are me, as DM,
trying to kill anyone...other than in-game "makes sense" reasons, i.e. The BBEG is after you and wants you dead. They're going to use what's at their disposal to make that happen.