I think that there’s a few ways to make a “good” villain, and that it’s not necessarily conducive to a certain type of villain, but just how you create that type of villain and then continue to portray them.
There is, of course, the sympathetic villain. This one can be great if you have a solid reasoning behind why they do what they do- whether it be that they sincerely believe that they’re doing the right thing or (and what I sometimes find even more compelling) when they know that they’re doing something wrong and part of them wishes to stop, but they just can’t see another way to do what simply must be done.
Then there’s the sorta “true” villain. I think that one of the easiest characters to point to who fits into this category is The Joker. These are the kinds of people that have no remorse, that just “want to see the world burn”, and can end up as great villains who we love to hate (or hate to love). I like these because, sometimes, you can just have fun with them, much like they can have fun with themselves. They have no moral code so you can go crazy with them and what they do. These people become especially threatening, and fun, when they’re smart, and when you know that they “just want to see the world burn” and that it may just be possible for them to achieve that. This kind of character can be fun… but I find it’s often done best if the writer is the one having fun with them. Otherwise they can just come off as flat villains with no… method to the madness, persay.
Then there’s one of my favorite kinds of villains- those who aren’t, or weren’t before. Those who are portrayed as villains working against the hero throughout the majority of the book, film, or other form of media, and then at the end (and hopefully via a slow realization throughout) you, the reader, realizes that maybe they weren’t the villains after all, but either the protagonist, or someone else, was. I think that this can make a villain even more fantastic, whether your talking about the one you previously viewed as a villain or the one you have to now view in such a light. The former because it’s been so drilled into you to root against them but now you find yourself rooting for them, and the latter for the very reverse reason. It can create a lot of conflict within the story and since the reader/viewer/etc. was already attached to the new villain, there’s a lot of conflict and emotional investment there… meanwhile, they can struggle to attach themselves to the old villain as well, which creates the very same thing.
But, overall, I firmly believe that the strongest part of making a good villain, no matter what kind of villain you’re creating (and whether it was listed up here or not) is consistency.
If your villain has a strong conviction for doing what they do, then they should act in accordance with that conviction, and unless something horrible happens in the story they shouldn’t just randomly go crazy and try to do something far outside what they believe in. If your villain is a villain “for the fun of it”, then it’d be jarring and weird to suddenly have them go into some deep, dark backstory as to why they do what they do. If your protagonist is the villain then it’d be odd to paint them as such when all they’ve been doing throughout the story is beneficial to everyone, and suddenly say you were rooting for the wrong person.
And this goes for everything your villain does- if they’re smart then don’t have them leave the hero in an easily escapable situation, if they’re ruthless then don’t have them spare the hero at the moment of the final battle, and so on.
Overall, I’m a firm believer that you can make a “good” villain out of almost any kind of villain (note that I said ‘almost’, I’m sure that there are exceptions). And, granted, some are harder to make into good villains than others (ex. I think that the “villain just for the sake of it” is one of the hardest to make feel real)… but with enough polish and practice I’m sure it could be possible.
That, and I agree with what @ParrotWatcher stated:
Fear is a powerful emotion, and (to sum up everything I’m trying to say, in essence) I think a strong part of what separates a good villain from a bad villain is how the audience reacts to them, emotionally.