People can have various reasons for supporting someone in a certain position.
Think of the weak king no one much likes, but the powerful like keeping him there because so long as there's a weak king in place they can get away with all the corruption they're accustomed to. If the weak king is deposed and a powerful king takes his place, it's a threat all that corruption may end.
So you sort of need to know why the group is supporting Guy X in the first place. It might be that Guy X used to be cool, and now he's going through something in life and has just become a dick, and the group is still supporting him out of loyalty but becoming increasingly disenchanted with him. If you then challenge him and deal him a blow, it may open the group's eyes up to the reality with him, and they will all start attacking him and push him out.
On the other hand, it might be that for all Guy X's apparent dickishness, Guy X is fulfilling an important role for the group -- one maybe you do not realize -- and that when you attack him, rather than getting everyone to join in and also attack, you cause them to rally around him and attack you.
You see this dynamic on forums when new guys come in aiming for senior members. These guys typically come in, don't agree with what senior members are saying, have this thought in their head that, "These senior members are probably only senior because they've been here a long time. But the truth is they all suck. I will expose these emperors as having no clothes, and then everyone else will join in and we can push these guys out and have a much better place, with me as a leader or one of the leaders."
Sometimes that works out for them, to some extent (they carve out their own base of supporters) or large extent (they troll the senior members out of there and become the new regime). Oftentimes it doesn't work, and they instead trigger an immune response from the group against themselves.
In situations I've been in when the leader is a douche but others are cool, I will tend to talk to people one-on-one, feeling out their opinions without exposing my own. "Hey, what do you think of Guy X? Everyone here is cool but he seems like he's always taking advantage of people. What's the deal with him?"
Typically people will depend the leader (unless they've really had enough of his crap), but you can get a sense for their true feelings by the nature of their defense.
If it's, "No way, Guy X is the MAN! He brought this group together! He [blah blah praises]," then you know Guy X commands a lot of loyalty and it'd be your funeral going up against him (unless there is, like, one or two loyal people and everyone else is tired of him).
But if you're getting a lot of, "Well, Guy X used to be cool, but every since his girlfriend got caught fucking that midget he's turned into a massive douche," type comments, where people are expressing displeasure at what Guy X is doing, then you know it may be safe to start challenging Guy X openly.
Still even then you want to modulate your tone based on the sentiment of the group. If the sentiment is "he did good things back in the day but now he's not good anymore" your tone should be one of respectfully putting him out to pasture. Whereas if group sentiment is "he is just a gigantic dickwad; nobody likes him" then you can just tear into him and know that everyone else will be secretly or openly cheering you.
Mostly it comes down to just reading where everyone else's head is at, that way you can be the best representative of group sentiment.
If you don't well represent group sentiment, you're likely to come out the worse in any kind of power struggle.
However if you've accurately captured group sentiment, and can speak/act in a way that captures the mood of the group, you're very likely to turn things your way (unless the individual you're going up against wields position power that is not fully reliant on charisma/group support; e.g., you can be a junior police officer leading a popular insurrection against an unpopular police chief, but the police chief is still the police chief, and he can still just have you fired. On the other hand if it's a group of friends and the unpopular alpha guy's only the alpha because people defer to him, and he has no position power other than that, and you lead an insurrection against him, you may well humiliate him, unseat him, and push him out of the group).
Chase