It's All About Me
The first thing you need to remember about villains is that they think your book is about their story and struggles. And, in a way, it is as much about your villain as it is about your hero and heroine. If you're going to have a bad guy (or girl!) in your story, it makes sense to have him as fleshed-out as your hero and heroine, with his own goal, motivation, and conflict. It's no contest fighting a cardboard villain, and no fun for the reader either. Yaaa-a-awn.
Remember that your villain believes he is in the right, and that's what makes him battle your hero so tenaciously. So spend time on his story, and what makes him tick. You don't have to agree with his goal, but it must make sense and be a solid one. Get into his head and find out why he does what he does. It helps to have planned out his story arc, even if the reader doesn't see it all on the pages. The more thought you put into your bad guy, the more of an obstacle he'll seem to the good guy. That makes for a great read.