Writing Men that Ring True

 Receptionist: "How do you write women so well?"

Melvin: "I think of a man, and I take away reason and accountability."   --As Good as it Gets (1997)
When inventing a character of my own sex, I find I have limitless amounts of inspiration. As a woman, I can draw qualities from myself or from my sisters and close friends. I can reflect on other female fictional characters with whom I have felt a connection. But when it comes to writing male characters, I have found it involves a good deal more work. Because ultimately, they are a strange species whom I do not understand.
Creating male characters who are good guys is somewhat of a challenge, but the villains are the hardest to create. It's so easy to create that one-dimensional misogynist who gets off on causing pain and is bad just because he's always been that way. You'd be amazed (or maybe you wouldn't) how often I would hear some young lady in my undergrad literature classes calmly explaining that the male antagonist acts that way because "men are just like that."
But they're not. They're complicated, even the ones who say they are not. So how do you go about creating a male villain? First and foremost, understand that your villain does not think he is a villain. He is a reasonable person who wants reasonable things and its not his fault that the protagonist is getting in his way.
For me, all of my primary protagonists will be women, so deciding how my male antagonist feels about women is of primary importance, as it will dictate how he interacts with my protagonist. Above all things, your villain knows that he is absolutely right. Not about everything, just about the issue that puts him at odds with your protagonist. And like it or not, when dealing with heterosexuals of the opposite sex, gender relations will come into it. Men don't treat men the same way they treat women. Ever. And women don't react to men the way they react to women. Ever.
Though Ken Follett's The Pillars of the Earth is a literary masterpiece, his villain, William Hamleigh, is one of those stereotypical woman-haters. Vicious and evil, everything William does is because he just hates the womenfolk and any man who doesn't kowtow to him. I find these men to be too easy to figure out, too easy to manipulate. It's easy to see what they want. It's easy to twist them. Flattery and submission are way past being interesting for me.
So my characters are never such blatant misogynists, nor are they sadists, because in my experience, people like that are much rarer than Hollywood would have you believe.
In the Siren Song series, my men are almost all brujos (witches), so a certain deviation from realism is needed. But with my upcoming Mason Timeline series, all the men, including my villains, are all too real. Specifically, I used negative but not over-the-top qualities I saw all too frequently in my Marine Corps days.
The key is to define what the villain wants. What does he need to do to accomplish what he wants? And here's the important bit: Why does he think the female character is standing in his way? In other words, what motive is he attributing to her?
Projection is a very common psychological phenomenon in which we think other people are like us. Thieves think everyone else will steal if given the opportunity. Cheaters always think their partner is cheating on them. So the beliefs your villain holds about your protagonist will be a powerful character-building tool.
Let your male characters, especially the villains, speak truth to your reader. Not just about the plausibility of your plot but about humanity in general.