There are a number of ways I've seen people handle this:
Democratic NPC Control
This is perhaps the most schizophrenic option out there, since the NPC is literally following metaphorical voices in its head, contributed by the players. It essentially becomes a GPC (group player character), with some noticeable downsides. If players don't agree, a resolution system must be settled upon (though if the NPC is insane in-universe, they could just have an in-character breakdown, but that's typically not what these try to do).
Timeshare NPC Control
Basically, each player controls the NPC for a session, then hands off control to the next player. There's a fair degree of flexibility in how the NPC is handled, but for the most part they won't directly contradict themselves as the players change their minds (since, after all, they don't have multiple people disagreeing about courses of action trying to justify their actions to each other). This system works less well when sessions are somewhat irregular in length, or when the NPC is sort of an "in-and-out" character. Some of this can be negated if the NPC simply replaces an absent player.
Corrupt Democratic NPC Control
Essentially, the way this system works is similar to the first method, but instead of simply letting everyone vote, everyone gets a certain amount of tokens per session that they can use to make their vote count more. "Everyone is equal, some people are just more equal." It gets rid of some of the problems, with the only issue being how to handle the bidding (First-come first-serve? Or highest bidder?) and the amount of tokens distributed, and what to do when people run out or if a majority votes for something but a single person offers tokens for an alternate course of action. I'm actually going to try something like this with one of my groups for an experimental game I'm planning in which all the players control only one character.
In Universe Control
Players must control the NPC with their characters, whether it be with magic, coercion, or persuasion. This gives characters with high social skills an advantage, but has the downside of making it so that they can easily monopolize the NPC unless they get bad rolls. Naturally, NPCs would be using normal resistance against these things, and may turn hostile if mind control spells fail, so that would be a potential downside. Alternatively, a MacGuffin magical artifact could do this as well, but would be slightly iffy for playing RAW, which is essentially the typical goal of this method. Essentially, whoever last succeeded in influencing the NPC controls their actions. Alternatively, he could "self-guide" under the DM's supervision, only following explicit orders from characters and sort of doing the rest on his own (for things such as walking with the party, attacking or healing in combat, etc.).
Mind you, all of these are things that are not conventional in tabletop games. Traditionally, there's a reason that NPC's are called NPC's, and it's because the "N" stands for "non". Usually when I see characters like this, they're just handled as DM/GMPC's, and that's what I do 99% of the time myself.