I just read a good article about creating effective villains here – “5 Characteristics of an Epic Villain” by Antonio del Drago, who is right on the money when he says Darth Vader is a fantastic example of an Epic Villain.
His advice and 5 characteristics are good, but it really depends on the style of your piece how powerful and brilliant you want to make your villain. There is a whole continuum available here, from the flawed/foolish/not-so-bright/extremely human baddie to the all-powerful/crazily dangerous/nearly-unbeatable villain. Which fits the best in your world?
A real gem to keep in mind is this, from the comments: Remember that the villain is the hero of his own story.
Though the author says you shouldn’t create dumb villains who make foolish mistakes, don’t forget that if you’re writing comedy, or for very young children, this is actually the perfect villain to have. You don’t want to scare wee ones right out of their socks, and allowing them to feel a little superior to the bad guy will help them to enjoy the story. (Remember King John in the old Disney cartoon version of Robin Hood, who cried for ‘mama’ and sucked his thumb? For preschoolers that is comedy gold!) The bottom line: know your world/genre, and know your audience!