When writing a story you may find that the good guy has access to a limited range of emotions compared to the bad guy.
Basic emotions (happy, sad, angry, etc.) are easy enough to evoke, but more complex or darker feelings tend to be more difficult to justify.
For example, if the hero’s best friend wins the lottery, a good guy would react how? If he’s a decent human being, probably by being pleased for his friend.
If a friend of the villain—usually a not so wholesome individual—wins the lottery, then the response can be more varied. Pleased (because he plans to ‘share’ in the wealth), jealousy, resentment, maybe even plans to steal the money. These darker thoughts are often more interesting and offer more ideas for where to take a story.
While making your main character evil but still likeable is a very hard thing to achieve, that doesn't mean you can’t give them (and the reader) the chance to experience the darker side of their personality.
The main character in a story has to appeal to the reader. They’re going to be stuck with them for quite a long time so making the despicable probably isn’t going to do you any favours.
But we all do questionable things and show poor judgement at times. Part of being human is making mistakes, often hurting others in the process. Exploring that side of person is a big part of fiction, and if handled well can be very satisfying.
The truth is though that readers often respond better to characters who do nothing bad, are never in the wrong and behave honourably. They might find themselves in trouble or accused of wrongdoing, but through no fault of their own.
It’s part of human nature to consider one’s own feelings of being unfairly treated as entirely justified, while other people’s are childish and petty. And in fiction we can easily relate to people who are suffering in similar unfair fashion.
Should you, however, wish to delve into the dark side of your characters a little more there are ways of keeping them likeable. These techniques can, like any, be abused. Used to their extreme they can even allow characters to do horrible things while seemingly still being on the side of good, but if used sparingly they can allow you to add depth to both your characters and your stories.
First and foremost it helps to make characters aware of their own shortcomings. That doesn’t mean they get to avoid them, but when they do behave less than perfectly, simply acknowledging that what they did wasn’t all that great can make them more human.
So, for example, if our hero whose friend wins the lottery feels envious and pissed off that he’s sitting in his studio apartment eating noodles (again) while his buddy is out having the time of his life, then addressing this emotion, maybe by talking to someone about it, makes him less of a bad friend and more of a regular human being struggling with feelings we all struggle with.
In effect he becomes two people, both a bad guy and a good guy, in the same person. The conflict between these two creates tension and drama, and it gives the reader someone to root for.
In addition to this, it also helps to raise the stakes to help justify those feelings. If our hero needed money badly, but it was his friend who got the windfall, you can understand his disappointment. Taken to it’s extreme, though, this can also allow you to take a character into very murky waters.
If a terrorist has planted a bomb that will kill thousands, is it okay to torture him? And to feel no remorse while doing so? This is a common trope in thrillers where it’s almost seen as the duty of a character to act inhumanely if the stakes are high enough, even to revel in it.
And readers will more often than not buy into this logic because a writer has the advantage of getting to show the methods used actually working—the disaster is averted, the kidnap victim is found—and out leave out any of the collateral damage.
At this point I'd like to take a moment's silence for the all those construction workers and janitorial staff who died on the Death Star and Death Star 2. Never forget.
Another method is relativism. If the hero is surrounded by people who are much worse than him, then his behaviour can seem quite honourable.
A bank robber who plans to steal a lot of money may not seem the likeliest of heroes, but if he is in a gang of vicious thugs and he tries to prevent them from hurting people then he becomes more likeable by comparison.
This is, of course, a very dubious line of thinking. If a man is a professional thief chances are he isn’t all that pleasant, but in fiction you can present characters in a flattering light even when they’re doing terrible things.
In cases like this it also helps to give them a good reason to behave badly. If the money is for grandma’s operation, the bank thief is seen as someone doing what he’s got to do, rather than just a greedy a-hole who can't hold down a job.
Again, it also helps if he is aware that he’s doing something bad and regrets it. You often see this through the ‘one last job’ trope. The more reluctant he is, the less we blame him for breaking multiple laws and biblical commandments.
It’s very easy to end up in very clichéd territory here, as every character who is meant to be sympathetic has an excellent reason for doing what he’s doing, usually involving a dying relative. But there are other reasons out there. Probably.
You can also have a character have a change of heart. If someone who does bad things decides to change his ways and even uses his nefarious skills against his own kind, that is seen as a respectable pursuit.
The classic example of this is the hitman who refuses to follow orders and kill his target (usually a child or a woman) and then goes on the run, killing those trying to kill him and his new best friend. He’s still a psychotic murderer, but now he’s using his talent for shooting people in the face for good. Hooray!
But the dynamic works for less extreme scenarios. A character who decides to fix whatever problems they caused (even by questionable methods) can be quite appealing, especially if they have to become an outcast to do so.