I think one of the things that makes a dungeon work is a nice blend of safety and danger. Much of the time you're safe, interspersed with extreme danger. If it's dangerous all of the time, you really have no incentive for either moving ahead or staying where you are and great incentives to just leave. Even S1 The Tomb of Horrors isn't dangerous 100% of the time in 100% of the places.
Equally, if you've got a mix of monsters, traps, empty spaces, etc. without a tie-in the players can't predict dangers ahead well enough to make informed choices. And without informed choices and expectations, you can't pull the old switcheroo of the helpful trap, friendly enemy, trick treasure, etc.
Something usually has to be the case to make the other cases remarkable, and something has to almost always be the case to make the other cases a surprise.
I've started to think of this as the "Usually Principle." It's not a great name, but it's how it sticks in my consciousness while I stock my dungeon. It's something that's fairly obvious, but also easy to forget when you're putting in traps, monsters, "trick" areas, etc. without considering the expectations you've laid out. This is how I've learned it applies to my megadungeon.
The Usually Principle
In order to take advantage of player expectations to make something surprising or remarkable, you have to
If you want friendly monsters to be remarkable, then monsters usually need to be hostile.
If you want the dungeon to feel like a big, mostly empty place with pockets of danger and reward, areas the PCs explore need to be usually empty.
Trapsare remarkable when they are occasional, because corridors and rooms and doors are usually not trapped.
No Mana Zones and No Sanctity Zones are remarkable when magic usually works well everywhere.
You can cluster things - an area of friendly monsters, a themed trapped area, and area of safety - in order to make them more predictable and reverse this principle. Themes are good. And things can be reversed - S1 The Tomb of Horrors is a good example of an area where things are usually trapped, D3 Vault of the Drow an area where monsters are usually not hostile (if you've taken basic steps to ensure that), town is a place that is usually safe, etc. The exceptions become noteworthy, and are more likely to take you by surprise and feel more rewarding if you encounter them.
It's tempting to put down the numbers from Pareto's Principle here, 80-20, but that's just trying to attach a basic design goal to specific numbers just because they're out there. It doesn't need to be that specific, and it works better if the players don't suspect there is a specific number they can reverse-engineer.
Ultimately I've found that's worth keeping in mind that you need a lot of one thing before the exception is remarkable, and almost entirely one thing before the other thing is surprising. If 50% of doors are trapped, then expect 100% of doors to be checked for traps. If it's more like 20%, players might start to get lulled. If it's more like 1%, "I check for traps" will fade long before they open that one trapped door.
Corollary: Rules Before Exceptions - in principle, it's better to expose people to the general, typical case before they run into the unusual case. The friendly troll is more interesting when you've met the typical, unfriendly trolls before that encounter. The mimic works best when you've opened chests and listened at doors for a while that weren't mimics. The weak dragon is interesting when you've fought strong dragons before and can sense your advantage here. Generally - there are exceptions, and if they're telegraphed properly they can work. But if you usually lead with the exception, the normal ones will seem bland when encountered and the exceptional ones won't have the impact you want.