Oh boy. I like this one.
Unfortunately, The Mood is Write nailed the best technical way to design a villain already. I'm going to just talk for a bit, though, and see what happens.
I've played the generic "bad guy" a couple times as a favor to a friend. That involved sending some minions to mess with the heroes, subversion and setting up a climactic final fight. I wasn't being super serious with it but everybody seemed to have fun. Well... the person who asked me to play the bad guy had fun. Everybody else sort of died or quit.
I don't usually write straight villains. Being bad for the sake of being bad is boring to me. My bad guys tend to be of the Hans Gruber variety; somebody who wants something, has the means to get it and has a relaxed or a-typical moral code. I also greatly enjoy simply writing out the opposing faction and aligning my players against them through practical means. There are not often true villains in my games.
Of course, I say that and then remember some really bad characters I've cooked up. Seeing as some of this is difficult to quantify, I can give you some examples.
The fixer for one of my games is, by all accounts, prime bad guy material. His goal is to destabilize a government and he is using the players to pull off seemingly unrelated missions that move him closer to this goal. He protects his people and outfits them with all the good shit to do the jobs but he is an agent of chaos in this story. By extension, the players are his evil minions. You could run a campaign against the team and it would end up being a classic good against evil scenario. The players don't expressly know they're working for the "bad guy", but they also don't know that the people running the government are just as bad in their own ways.
There isn't really one prime way to build a villain. However, I find that the best thing you can do to set players against a villain has much less to do with their personality and much more to do with having an impact on the party. As an example, I played a Deathwatch game where my antagonist recruited the party to track down a planet that had just recently been revealed from the warp. Along the way, the party started to doubt the necessity of completing this task. So, he ended up betraying the party and endangering some of their brothers while at the same time ensuring they could follow him. When the party caught up, they were orbiting the target planet. He ended up giving the honor and glory of dealing with the planet to them while also setting them up for some very good rep with the Imperial Navy. Yet, at the end of the campaign, three players swore death or revenge against him.
The impact there was, I believe, a shot to their pride. They had been played by my Deathmarine and were not having it, no matter what the outcome ended up being.
Another character I set up recently for my ongoing game is a straight megalomaniacal ass with delusions of grandeur and, sadly, a position to match. The party ended up splitting between a guard team escorting a caravan and an emergency team transporting two wounded members. The emergency team arrived at the nearest city and sought a healer for their two wounded members. The leader of the city set himself up as the king of the land and said he would only heal the two wounded people if he was given one of them as a slave (one was a hot she-elf and the other was a super useful mage).
The "King" was a self-important, flamboyant ass. His first impressions made the party want to attack him on the spot. His demands, curiously enough, didn't phase the players more than his mannerisms (my players probably aren't good people).
A few days later in RP time, the other half of the party was ambushed just outside of the city by mercenaries who were working for the King. He was actively raiding his own incoming caravans to take his own people as slaves and steal their goods. So now the party isn't going to be paid what they were promised and half of them are badly hurt and in jail while the other half have to figure out how to extract them.
Admittedly, I'm probably also not the kindest GM.
One character, whom I designed to be an unlikable bitch, ended up finding a small fan club with my players. She was the Silver Lady and was the mercenary the "King" hired. When the King expressed interest in their guide (a timid beastkin ranger), the Silver Lady spoke up, said she had already been branded and called her a whorespawn. Miss Silver has the storybook beauty of a Disney princess but is ripped like she tears people in half as a hobby and walks around in armor with a greatsword. So far, everybody likes her - and that's even after she attacked the other half of the party.
I guess I really don't know how to make a good villain? Although, I've been told by one of my players that she was surprised how much they disliked the Silver Lady, which made them like her as a character. It was flattering but also confusing to me.