There's an occasional simmer on the IGDA forums about how to write a decent villain. People come up with a lot of interesting theories, but I don't much like them. That is because (as most of you have probably come to expect) I have my own opinion on the matter.
A good villain isn't good because he, she, or it is something we can empathize with. The villain isn't good because they pose a real threat. These two factors are often found in good villains, but correlation does not imply causality.
What makes a good villain is something strange where we expected something else. Also known as "a twist".
By strange I don't mean "unusual". I mean "mind-boggling".
Here's an aggregate list of some villains most people consider to be really "good":
Darth Vader. The Terminator. Alien. Norman Bates. Hannibal Lector. Jaws. Hans Gruber in Die Hard. Roy Batty. SHODAN. Scorpio (in Dirty Harry). Dracula. The Joker. Mr. Hyde. Agent Smith. Freddie Krueger. Wicked Witch of the West. HAL. Any nuclear winter.
(Okay, my media preferences are showing through...)
Both these villains and the villains from genres I'm not a big fan of arise from showing you something you didn't expect and don't really understand in a situation where this oddity is extremely clear.
For example, in the Wizard of Oz, everything in Oz is bright and shiny Technicolor. Prancing midgets are the most common life form.
The Witch, however, is the exact opposite. A blot on OZ.
Some villains are the reverse. They are evil incarnate, unstoppable killing machines... until you show the audience a blot. In this case, the blot is in reverse: you show them a spot of sympathy. Darth Vader and Hannibal Lector are perhaps the two most obvious versions of this: both are killing machines, but both are shown with a surprising, sympathetic element that makes us go, "kurwhat?"
You can also continue and put a blot on the blot - as Hannibal Lector did. He is a brutal killer who eats his victims. The unexpected twist: he's polite and friendly. The unexpected twist in the unexpected twist: this doesn't keep him from eating your liver.
In my opinion, that is what makes a villain. Something unexpected: a twist on whatever the playing field is. Whether it's a person (Darth Vader, Norman Bates) or a thing (The Future, Oz, "Tomorrow"), put the twist in and that twist becomes a villain. The twist can be sympathetic, if the playing field is evil (Darth Vader) or dark if the playing field is sympathetic (Norman Bates).
The Terminator is a dark twist to a normal, everyday situation. The second movie was brilliant because it was a bright twist on a dark twist on a normal, everyday situation.
Roy Batty was the same: he was a dark twist on a sympathetic situation (a human-like creature gone horribly wrong)... but he had bright twists in his dark twists.
People who have played my tabletops may remember that many of my villains use this exact philosophy.
So, I guess what I'm trying to say is...
Baby, baby twist it!
Ooo-ooo-ooo, just -
Round and around and around and around
Just like this!