PCs die in my games. I do not protect them. I do not shield them. They die when the dice, or their actions, are the proximate cause. I do not fudge dice, change monster tactics, or otherwise gives them an out - although there are a lot of ways to find the resources to prevent the death.
That being said, my approach tends to give them less situations in which they are at higher risk. I use a lot of easy and moderate challenges where threat of death is not what is making the combat a challenge - it is the risk of the monsters achieving another goal. It might be stealing, kidnapping, arson, capturing a PC, finishing a ritual, raising an alarm, activiating something, etc... When I use a deadly or Deadly plus encounter, it stands out.
Level 1 and 2: This is the range of levels with the highest death tolls, even though PCs spend the least time here. They're so squishy that one bad roll, or one bad decision, can kill them. The situations in which they find themselves are often not horrific, but there are ways for them to get themselves killed, and sometimes the dice just decide they're going to die.
Level 3 and 4: PCs are not yet "heroes", but they're venturing into areas where nasty stuff exists. If they hear about the lair of an adult dragon and go hunt it out, they're going to suffer the consequences. As a DM, I want the PCs to feel like they're in a scary world at these levels - and that they need to be cautious. When describing locations, I often refer to doorways as exits, and describe the potential escape paths. This drops in their mind that they should be thinking this way. A well planned party that makes good decisions should likely be able to avoid deaths, but I have been unable to test that theory in 40 years of D&D as I have never met a well planned party that makes good decision.
Levels 5 to 10: PCs are now officially heroes. They can do those 3rd level spells, multi-attack, etc...and are generallysignificantly more powerful than 4th level. This is therange where the stories really start to unfold, and the PCs take starring roles. Still, they can die at any moment, and sometimes in ways in which Revivify is not an option, and recovering a body can be tough, if not impossible. Permadeath is rarer, but happens.
Levels 11 to 16: PCs are the Super Heroes. They're not just fighting off the ogres - they're taking on Huge Dragons, Beholders and Liches - threats that shape regions. They travel the planes. They have the resources, usually, to reverse almost any death. Permadeath only happens in very limited situations, or when there is a TPK ... which does happen. If I run a monster that is extremely intelligent and wise - and that monster is prepared for the PCs - I am not going to give them the monster on a silver platter. It will likely be prepared and defended to the best of its ability.
Levels 17 to 20: At these levels, even a TPK is not permadeath, generally. The PCs should have powerful allies that will have a vested interest in their recovery. That is why Levels 17 to 20 in my campaigns are generally 'on a clock' requiring the PCs to achieve something in a set amount of time. A TPK slows them down a lot. That may cost them when everything comes to a head.