Let's see, if you are really set on having a villian escape, give them a healthy dose of survival instinct.
Have them run once they are down below 1/2 HP (or 3/4 for really cravenly villains). The PC's will probably assume that one more hit will take the villian out. Maybe a Magic Missile, or an arrow. They might not consider pursuit until after the villian keeps staggering onward and has already obtained too great a lead.
Another option, if you have a group that believes in honor. Have the villian challenge one of the PC's for the right to leave unharmed. This does not need to be a fight to the death, maybe just to unconsciousness. If you do this, make sure the villian has honor too! Maybe even to the point of stabilizing the PC that lost. With the right party, this can work very well. With the wrong party, the villian is toast.
The wave of low level grunts works. The PC's have to deal with the immediate opponents in front of them while the villain slinks away. Though, a clever party can easily prevent this.
Another honorable/good party option. Have the villian surrender. Now, they have to safeguard a prisoner. If they have any semblance of law, that also means they have to protect the villain from rivals! They will have to expend resources on keeping watch so the villian doesn't escape and is unharmed. They have to bring the villian back to face justice. They have to prove misdeeds. You get the idea. In players terms, it works like this. "Oh great, now there are plenty of chances for the DM to screw us!" While I don't advocate that strategy, it is likely what the players will think. However, you can use this as a great way to establish how the local kingdoms' legal systems work. Perhaps the PC's can't prove a crime. Perhaps the villain can wiggle free through a loophole. Again, with the right party, this can be a lot of fun and cause some great RP.
Spells - A ton of them. Travel spells are great, but do not overlook illusions. Programmed Image, Mislead, Veil, are some nice high level spells. But even a mundane Invisibility and Silent Image can help a bit. Heck, even Darkness can give you a bit of a good lead. Creativity is your friend. But, the PC's can bypass these with good saves, dispel's, True seeing, etc.
Equipment - Don't underestimate the value of a bag of caltrops, tanglefoot bags, thunderstones, trip wires, etc.
Planning - If this is the villains fortress, a good escape path should be available! Especially a smart villian. Why not have the escape path lead straight into a maze? Over a rope bridge that can be cut? Or over/under/across/through and number of things that could be setup well in advance. Heck, have fun with the party. Have the villian run down a narrow, twisty corridor with pit traps. Each pit seems like a chute that slides down into the dark. The party has to decide if the villian used the pit as a chute leading down to a safe escape, or if that chute leads down to death. The longer they pause, the further ahead the villian gets. Of course, there is nothing saying you couldn't prepare for either choice to be "wrong" and the villian gets away.
I might have more ideas later. Let's see how this does for now.