She had always found villains more exciting than heroes. They had ambition, passion. They made the stories happen. Villains didn't fear death. No, they wrapped themselves in death like suits of armor! As she inhaled the school's graveyard smell, Agatha felt her blood rush. For like all villains, death didn't scare her. It made her feel alive.
― Soman Chainani, The School for Good and Evil
A good villain must be credible, logical, and understandable. Your readers need to understand why the villain is doing what he does, and why he believes his actions are justified and rational, but you don’t want them to emphasize with the villain to the point where they’re cheering him on instead of the hero.
Your hero and your villain need to be fairly equal in strength. If your hero is intelligent, make sure your villain is close enough of a match so that conflicts will not be easily resolved. Show that your villain is quite capable of winning the battle and make sure that it seems as though the outcome of your plot is uncertain. That uncertainty doubles your suspense and gives you the perfect opportunity to showcase your hero's qualities as well, thus creating a stronger protagonist just by displaying the comparisons.
Villains don't always think of themselves as villains, but they definitely have an agenda that is in conflict with the hero's goals. Give your villain a back story to show what is motivating him or her to do the things that are in conflict with the hero.
The best villains are unconventional, unpredictable, and morally ambiguous. They are rebellious, individually motivated, intelligent, and capable. Evil characters who are evil for the sake of being a literary device are both predictable and flat - they lack a moral depth and present little challenge to the hero. All too often the villain ends up a one-dimensional, stereotype of evil.
Think about when you created your protagonist. You gave him thoughts and feelings and flaws, strengths and weaknesses and motivation. You took the time to get right inside his head to understand what made him tick. Your villain deserves the same consideration.
Remember that no one sees themselves as mean or evil or bitchy or insane or stupid. Your villain won't either. To him, his actions and his logic are perfectly justifiable. You need to show your readers this side of your villain's logic which will intensify your story's suspense factor. Show that your antagonist is quite capable of winning the battle and make sure that it seems as though the outcome of your plot is uncertain.
That uncertainty doubles your suspense again, and gives you the perfect opportunity to showcase your hero's qualities as well, thus creating a stronger protagonist just by displaying the comparisons. Your readers will be turning page after page to find out if your hero is actually good enough to overcome the monster you forced them to care about, in a twisted kind of way.
If you can actively portray your villain in his own point of view as being an intelligent, logical, complex creature with the capacity to be understanding and reasonable, who does what he does because his reasons are sound to him, then you are on your way to creating a pretty believable villain. But if you can also show your villain's complex, devious, misguided nature from your hero's point of view, you know you've created a truly memorable bad guy, and you will have strengthened your hero’s character and your plotline at the same time.
A villain must be a thing of power, handled with delicacy and grace. He must be wicked enough to excite our aversion, strong enough to arouse our fear, human enough to awaken some transient gleam of sympathy. We must triumph in his downfall, yet not barbarously nor with contempt, and the close of his career must be in harmony with all its previous development.
― Agnes Repplier