I think the variables that make a mean or villain-leaning character likable come down to comedy, camaraderie, circumstances, self-consciousness, competence and consequences.
Comedy: If their personality can be played for laughs or the character in itself is funny, the audience is more likely to like them.
Camaraderie: If the interactions that the character has with others is comedic or heart-warming in spite of their bad personality, the audience is more likely to like them.
Circumstances: If the character came from a harsh upbringing or are in a situation that requires toughness or underhandedness to survive, the audience is more likely to give them sympathy.
Self-consciousness: If the character can recognize their bad personality and work to better themselves in some way, the audience is more likely to like them
Competence: If a character is witty or intelligent and can outsmart other characters, the audience is more likely to like them.
Consequences: If their actions mean something in the story or result in a shift in the status quo, the audience is more likely to give them sympathy.
Liking mean characters without any of the previously listed tropes is possible, but less likely. The first character I think of when it comes to this trope is Cartman from South Park. Cartman's antics are troublesome to say the least, but they tend to be funny and show off his competence. And he usually gets some form of earned, unfortunate consequences.