Well hum.
Most of my characters have been pretty well liked even though they are clearly flawed. I can try to examine some of them out loud and see if that helps. Talking about theories is fun but debating over how to build a bridge isn't always as useful as actually building that bridge - even if you fuck it up in the process.
So...
My flagship character is undeniably a bad person. I won't go into all of the reasons he is a bad person here. You'll just have to take my word for it. Although, I should probably say he is unabashedly a bad person. Might makes right sort of guy. Yet most people who play with him love him, like him or love to hate him.
He is arrogant, confident and smug, which usually sets people off on the wrong foot when they meet him. He is also quite clever and witty, which seems to make people think there is "something more to him". Confidence, in general, draws attention and his antagonistic personality provokes a reaction from those around him. He is the kind of character that, when he is around, people know something is going to happen and end up going on their guard.
He does not complain, boast or really offer insult to anybody. He isn't petty. He also doesn't hesitate to make an example out of somebody who challenges him. Curiously, however, he also doesn't tend to kill people when he fights and prefers instead to leave them in debt to him or leave them alive to fight again later. One of his greatest joys in life is getting into a person's head and peeling back the layers to see what makes them tick. So his goal is to provoke a response and to constantly test those around him.
I think people enjoy this guy mostly because he is interesting, entertaining and makes things happen so that others can join in with the fun.
Another character I briefly played was a Drow. His name was Nolan.
Nolan was a dick.
Nolan was also quite arrogant. He was petty, racist, quick to fight, a liar and often detrimental to his team. People would yell, "Nolan, why?" while laughing at his antics. He was also a bit of a badass and constantly pulled the wool over the eyes of the GM's bad guys. "I don't want to do what he says... but I'm pretty sure he could kill all of us on his own."
A couple examples...
The party saw a house they wanted to get to on the other side of a lake. One of the elves made a magical boat to cross it. Nolan opted to walk around the lake instead of trusting the dirty elven magic. He got there late. When he walked into the house, he saw nobody was there, however, there was a trap door open in the corner. So he walked over to it and yelled down, "Hey! What's going on down there?"
The dwarf of the party wasn't that, ah, aware of himself. His player was fun, though. He yelled back up, "Oh, you know. Just sneaking up on a dozen devil dogs."
"Oh," Nolan said. "Well, have fun with that." Then he shut the trap door.
Another moment was when they were trying to disrupt the bad guy's evil plan. The bad guys were also drow so Nolan had... pretty well just walked into their camp a couple times to perform some casual sabotage and to order their underlings around like the boss he was (I put a lot of points into bluff). They were digging a big hole for some reason and he recognized it was below the water level on an island. So he went down there and directed the dig crew to dig through a wall into the ocean - which they did.
On the way out he hooked up with a couple succubi at the camp's pleasure tent and walked off with them for some fun.
Later, he came back to that camp with an ally of his (who was also a drow). They casually strolled up and released one of the important NPC captives, then teleported out.
Finally, during the lead up to the dramatic final battle, Nolan went in to pave the way for them. There was a bridge built over the now flooded pit. Nolan got into a yelling match over the guard because he wouldn't let him see the bad guy. Finally, he got tired of that and whipped out his sword. When the guard only fought defensively, Nolan complained about being bored and just walked around him. He made it about halfway before the balrog looking motherfucker (some giant demon. I don't know) guarding the bad guy walked out to him and compelled him to jump off the bridge.
Nolan did, with glee, and swam back to shore. This pulled the demon far enough away so that the party could slip in behind him, surprise him and fight the boss. Meanwhile, Nolan made it back to shore and went back to the bridge. He was on his way to help when he noticed that the whole army was following him. So he stopped and faced them. He was a great fighter and never took a single hit. However, one of the demons did something that he described as, "Hocking a giant loogie at you."
Nolan was horrified at this. He stopped fighting then casually jumped back off the bridge, avoiding the attacks of opportunity that were directed at him. The other players were a little upset. "Come on, man," said my best friend, while laughing. I yelled back at him, "You don't understand! It's in my hair!" Nolan was also quite vain.
One of the things I always thought about with my characters was; if you want them to be likable without being all gooey on the inside, make them a dick first and nice second. Complaining and whining tend to just annoy people. Always having something to say is also annoying. When you burn somebody, make it a fun burn even if your character is trying to be petty.
The best advice I can offer is; play to the players instead of the characters. People aren't good at completely removing their egos from their characters. They are also not that good at considering their characters instead of themselves. They don't always enjoy the same thing that their characters might enjoy. At the end of the day, the goal is to entertain the player. I know this might not be the best "Puritan" look at it, but this has always helped me. So... know your audience.
Sorry if this was more than a little wordy.