During my planning for a new campaign based around loosely connected dungeoncrawls instead of a longrunning epic quest or an open world sandbox I realized what always had been missing for me from dungeon modules. (Aside from plots, since I used to be young and stupid.) It’s great villains. Great antagonists are one of the big draws of Sword & Sorcery and pulp adventures and even though some boss monsters from early D&D have become famous, the early modules consistently had a lack of actually great villains.
The main problem with a generic dungeon crawl is that it has enemies in fixed places and some enemies who are randomly encountered wandering around. And any supposed villain was almost always in his throne room or something to that effect, waiting there at the far end of the dungeon to be the big final fight for the dungeon. Saying a few arrogant lines before a fight to the death does not make a great antagonist. A great and memorable enemy for the players is a villain who does things and they have meaningful interactions with. In movies villains often have most of their scenes in which they show how cool and badass they are far away from the heroes and they only run into each other very late in the story. In an RPG that does not work. You only get the moments where the villain interacts with the heroes to make him cool.
There are several ways to do that before the final fight in which the villain is killed. A really neat idea that I’ve seen in many wuxia stories is that the world of martial arts masters is actually pretty small and everyone knows absolutely everyone else. Even if they’ve never met before, people have heard enough about each other to get a good idea who they are dealing with. In a campaign in which every NPC without a name has no character levels and the majority of named characters are only first or second level this can easily be made to be plausible as well, regardless of the specific setting. When a major antagonist spots the party he might be able to recognize them simply by their appearance and weapons and react to them accordingly. This is not so easily done when the players encounter a new NPC, but any NPC friendly to the party might be able to tell them about some of the people who have been seen near the dungeon or in the company of the dungeon’s current master. Though that friendly NPC might only have heard some vague rumors that could be of greatly varying accuracy and might be misleading the players to expect someone who turns out quite different in person.
Another good method is to drop plenty of clues about the presence and status of a powerful NPC in the area before and after they meet him in person. Captured enemies might talk about their masters and superiors or the party might overhear them talking about them. Or the villain placed a lot of recently made traps ib an area that seems otherwise uninhabited. Corpses of monster killed by antagonist who are nearby are another alternative. Lots of corpses full with arrows, cleaved into pieces, or burned to cinders will give the players certain expectations who they might be facing in the near future.
Something that is easily forgotten and never appears in published modules and adventures because it requires a lot of flexibility from the GM is that every NPC who isn’t killed can show up again in later adventures. Sometimes even if they have been killed (but don’t do that too often, it gets lame very quickly.) Often it’s presented as the default or even only option that any encountered enemy will automatically attack and be killed. But that’s really not necessary and also quite lame. Except for mindless undead all enemies want to live and rather escape than die. If you make use of that option you will end up with a lot of enemies who escaped alive pretty quickly. For the main villain of a dungeon I would even plan ahead to let him fall back a few times before the players might corner him. But only if it’s tactically possible. If the players manage to cut of escape routes or get a few lucky hits that kills the enemy leader in the first or second encounter than that’s what should be happening. It’s not necessary that he will still be able to fight in the last fallback position. The minions might fight on for a while by themselves before they flee from the party or a lieutenant might take over command for the big bad. That lieutenant might turn out to be the actual big antagonist the players are going to remember from the adventure.
If a prominent antagonist survives an adventure, I would not usually use him agaib right in the next adventure and go after the party. That would only encourage the players to never let anyone survive. Wait three or four adventures and then let the players have an unexpected run in with an old acquaintance of theirs.
Though all that being said, I think a dungeon crawls should still be about the dungeon first and everything in it optional. Instead of making a major antagonist the final goal of the dungeon, he should simply be the main attraction. The villain’s lair shouldn’t be in the farthest and deepest room of the dungeon but better in a more central area. This way the players are given plenty of opportunities to avoid a confrontation with something scary like an undead sorcerer or a dragon, but they also will get close to the lair several times throughout their exploration, which gives the villains more opportunities to be on the players’ minds, making them more memorable.