Biography
In a group of otherwise good friends, there's one character who's an unrepentant Jerkass to everyone else. Or, if they aren't downright mean or cruel, they may be so stupid, annoying, or just plain weird that it's embarrassing to be seen with them. In any case, asking a member of the group "Why are you even friends with him?" is a perfectly legitimate question. It can usually be answered with one or more of the following explanations:
Seniority — The group members have known this person for a long time. They might have even genuinely liked him or her at one point, but years of maturity and development (either by the disliked friend or by the others) resulted in this member no longer fitting in. Despite this, they continue to hang out with this person out of obligation, loyalty or familiarity.
Proximity — They're neighbors, classmates, family members, coworkers, landlords, spouses/partners or some combination of the above and the group simply can't be rid of them. So they have no choice but to tolerate the nuisance to the best of their abilities in order to maintain peace.
Necessity — They're worth keeping around because they're useful. Oftentimes, they possess skills or resources that no one else can provide or have qualities that hold everyone together in times of crisis. (Examples include the Bunny-Ears Lawyer, the Indispensable Scoundrel, The Team Benefactor, the Cloudcuckoolander's Minder, the Team Mom/Team Dad, or the Crouching Moron, Hidden Badass).
Control — Someone with power over the group (parents, teachers, bosses, etc.) is forcing them to include this person, who is likely a spouse/partner or relative to said higher power. The disliked friend could even be that authority figure themselves.
Fear — The last thing you want to do is piss this person off by telling them they can't join in. Similar to this is:
Goodwill — In which the others will allow the disliked "friend" to tag along not necessarily because they're afraid of his or her wrath, but because they are too nice/passive to tell them to sod off.
Pity — They're such a pathetic loser that the group just can't bring themselves to kick them to the curb. Alternatively, the group might keep them around because they are pathetic since hanging out with the loser makes everyone else feel better about themselves. At its darkest extreme, it can lead to:
Abuse — The group wants to keep this person around because they see them as a punching bag. Commonly, the group would have to be utter Jerkasses or bullies who seek pleasure in pushing them around. If the disliked friend gets fed up with the treatment and leaves the group, expect them to get treated in the wrong for doing so. Because Status Quo Is God, the disliked friend will be back in the group by the end of the episode. And while the group may have a Heel Realization and apologize for their bad behavior, they will go right back to mistreating their "friend" in subsequent episodes.
Audience Popularity — Sometimes, a jerkish Ensemble Dark Horse will start hanging around the group just to feature them more prominently.
Supervision — The disliked character is too dangerous or irresponsible to be left to their own devices.
Caring — Deep down, the group (or at least one member) really does care (or the disliked character cares about them), and the issues all boil down to difficult behaviour. Even the closest of friends fight with each other from time to time, but at the end of the day, they are still True Companions.
Deserving — Even if they don't care, per se, the group does recognize the character has some redeeming qualities despite their faults, or else they've done something to earn a place in the group.
It's not even that their friends aren't aware of their behavior, either. They're perfectly aware that the person is a jerk, or a geek, or a ditz, and will frequently treat them as such based on their behavior. They still get included in the group nonetheless, with the group often defending them if any outsiders insult or mistreat them.
In some cases, it's discovered that the group really does care about this friend and vice versa. In other words, "They may be a pain in the butt, but they're our pain in the butt." Often uttered right before such lines as "You mess with them, you mess with all of us!" or "We're not leaving anyone behind!" The character may have a breakout episode that explains the reason for their attitude or reveals a human side that never showed before (such as a cute hobby or a Hidden Heart of Gold).
More tragic examples may lead to the disliked character Jumping Off the Slippery Slope, and their former "friends" bitterly regretting that they tolerated someone so obviously malicious for so long. Mistreatment-Induced Betrayal can be at play if the friend gets fed up with the way they treat him. The may be the subject of Speaking Up for Another.
This is Truth in Television. Chances are you have a "friend" like this (or multiple friends), or you may even be that "friend" yourself.
Compare Vitriolic Best Buds and With Friends Like These..., where this kind of attitude is usually limited to one or two select members of the group as opposed to being the opinion of the group as a whole (though the latter trope can compliment this one if one friend is actively disrespected enough by the others).
This trope may overlap with Loser Friend Puzzles Outsiders. However, in this trope the whole social circle hates the "loser" rather than an outsider to the group, and the person may actually have some cause for being disliked. In the other, the person is usually presented as being an innocent victim of prejudice, whether it's related to social Darwinism, jocks vs geeks, Slobs vs. Snobs, or racism, fantastic or otherwise.
If The Friend Nobody Likes is a protagonist or otherwise portrayed sympathetically, he may instead become The Woobie. The Friend may also be The Gadfly if they aren't an up-and-out jerk.
If someone is disliked to the point that people won't associate with them, All of the Other Reindeer is in play.
See also My Friends... and Zoidberg, The Complainer Is Always Wrong, No Accounting for Taste (when a romantic couple are similarly incompatible), and Token Evil Teammate.