A very controversial example in the novel The Thirty-Nine Steps is a spy who, while very competent, believes in every anti-Semitic conspiracy theory under the sun. The character ends up assassinated, showing the problems which come from pursuing false conspiracies and overlooking real ones, but he is still treated with respect by his colleagues prior to that.
Let's not forget a certain violin-playing, drug-addicted, outwardly disorganized, self-aggrandizing detective named Sherlock Holmes. Holmes also regularly conducted very malodorous chemical experiments, decorated his wall with bullet holes, kept tobacco in a slipper, and correspondence pinned to the mantle with a knife. He also was a Master of Disguise who would often not even tell Watson that it was actually him.
Nor should we forget Holmes' (probably autistic) older brother Mycroft, who lived down the street from his government office, frequented a social club where none of the members were allowed to take the least notice of each other, had an almost obsessive hatred of going anywhere besides his apartment, his work and his club... and functioned as a living database, archive, and computer for the British government.
Important note, when we say "computer", we mean the machine, not the old Victorian profession.
"Why do you not solve it yourself, Mycroft? You can see as far as I." "Possibly, Sherlock. But it is a question of getting details. Give me your details, and from an armchair I will return you an excellent expert opinion. But to run here and run there, to cross-question railway guards, and lie on my face with a lens to my eye — it is not my metier."
Butters from The Dresden Files. The best pathologist in the city...but he loves polka music more than is healthy and wears bunny slippers.
From the point of view of the muggles, Harry himself. The cops at Special Investigations put up with his proclamations that he's a wizard because he gets resultsnote since he really is a wizard.
Also, the Wardens recruit him despite his severe authority issues (especially regarding the White Council) and history of dark magic because he's one of the only really powerful wizards left and is famous for rebelling against the Council, so if someone so anti-council is on their side, they must be doing the right thing.
We also get to see Harry's bunny-ears from Murphy's perspective. Harry is a guy who walks into a scene with an outfit that looks like it belongs on the set ofEl Dorado, asks a few questions that make absolutely no sense, occasionally does something strange like take a strand of hair from a brush, vanishes for two days and somehow makes an envelope with the exact information necessary to crack the case wide open and an invoice for twenty billable hours appear on her desk next Monday morning.
Bob the Skull is an extremely powerful spirit of intellect that has worked for wizards for centuries and has such a wide span of magical knowledge that the White Council considers him a serious threat and they'd be seriously pissed if they knew Harry has him. And he reallylikes porn and trashy airport romance novels.
Miracle Max in The Princess Bride. He's clearly got a few screws loose (and honestly, who ever heard of a miracle worker named"Max"?) but he did get the job done.
Discworld: Pretty much everyone, or at least the main recurring characters, falls into this trope.
The Librarian of Unseen University is an orangutan. He didn't start out that way, he got accidentally transformed and decided he prefers it. He hasn't been replaced or transformed back against his wishes because a) he's still very good at his job (in fact, he's probably better at it than he was beforenote He can shelve books with his feet and fearlessly read books that Man (note the specification) was not meant to know) and b) an adult male orangutan is considerably stronger than an adult male human, and the Librarian is not necessarily averse to expressing his displeasure physically. It doesn't hurt that bananas are cheaper than an actual salary. These days, if someone told the wizards that there was an orangutan in the library, they would probably ask the Librarian if he'd seen it.
The Bursar of the university is literally insane. Subverted slightly in that he has to take dried frog pills in order to perform his job, but played straight in that the dried frog pills don't actually make him sane, they just make him hallucinate that he's sane, that he's a bursar, and, incidentally, that he can fly.note And when a wizard hallucinates that he can fly, it's a bit... different from anyone else hallucinating they can fly. He's not allowed above the second floor, though. Archchancellor's orders.
Continuing with the Unseen University staff, there's Archchancellor Mustrum Ridcully. By most people's standards he's no stranger than other wizards, but to other wizards he's completely mad. He not only enjoys but actively encourages healthy exercise, puts a homemade and highly volatile condiment on everything he eats, and is about as subtle as a sledgehammer. He handles most matters through Obfuscating Stupidity, on the assumption that if someone is still trying to explain something to him after several minutes, it must be important. At the same time, he brought stability to UU, ending the tradition of Klingon Promotion by being pretty much unkillable himself.
City Watch Captain Carrot Ironfoundersson, a 6'6" dwarf (biologically he is technically human thanks to an odd birth defect commonly known as "both his birth parents are human") who is also (probably) the long lost heir to Ankh-Morpork's throne. Having been raised by dwarves, he has no concept of irony and has become either a Genius Ditz or a master of Obfuscating Stupidity. He also has the stones to arrest anything, up to and including a dragon and all the soldiers in two opposing armies who are about to fight a battle, for "Behavior likely to cause a breach of the peace."
It's implied that he started out as something of a Ditz, but is now just Obfuscating Stupidity, most of the time.
Also, Otto Chriek is a damn good photographer and a pretty nice guy, helpful to anyone who needs it... and a vampire who obsesses over photography like most vampires obsess over blood. And regularly harmed or reduced to ashes (he gets better) by the flash, much to bystanders' consternation.
This is common amongst reformed vampires: channel the obsession away from blood and onto a subject which is less likely to get you staked. The one with a coffee obsession was particularly memorable.
Similarly, Jeremy Clockson, a clockmaker with no sense of fun who is, in fact, too sane.
Leonard of Quirm, a parody of Leonardo da Vinci. Despite a habit of stopping in mid-sentence to play with folded-paper gliders and doodle schematics for working instruments of destruction in the margins, Lord Vetinari still employs him, and finds uses for all his ideas. Though "employs" is, perhaps, not quite the right word: the Patrician keeps him imprisoned in a tower and well supplied with parchment. Leonard genuinely appreciates both these things, since it keeps him from being distracted from his thoughts and sketches.
Also, after talking to Nobby in Jingo Leonard is even happier with Lord Vetinari's 'imprisonment': not only does he get all the materials he wants, but he is also well away from everyone who'd seek to turn his genuinely well-conceived ideas (such as guns, nuclear explosives, etc.) into weapons.
Marco Soto - one of the best field agents the Monks of Time have - refuses to cut his hair, as he believes it to be a separate entity that simply happens to live on his head.
Maladict, a vampiric Borogravian soldier, is a coffee addict who suffers deprivation hallucinations others can see about wars that didn't even take place on the Disc, carries a rapier he can't use properly to deter attackers because the only other option is to tear them apart with his fists, and is actually a woman.
Rincewind the "Wizzard" is the Disc's biggest coward, actively craves boredom, and is as competent at magic as a fish is at mountaineering, but when Ridcully is faced with the task of sending him on a very dangerous mission, he doesn't hesitate. Because no matter what the danger, Rincewind always survives. He spends the entire adventure running away screaming, but he makes it back, even from another dimension, the beginning of time, outer space, or hell itself.
In Cryptonomicon, Lawrence Waterhouse is a man who does something socially ept "once every two or three years" and enjoys three things in the world: cryptology, playing the pipe organ, and sex. (The third clears his mind, enabling the first, and the second can sometimes be used as a substitute for the third.) Very few people understand much of what he says, and he's never very sure of what's going on around him, but since it's World War II, the whole cryptology thing works out well for him.
Also, his grandson, Randy Waterhouse, who has a strange obsession with Capt. Crunch cereal, and tends to use computer, DnD or Tolkien analogies to explain things. He's also one of, if not the, best network engineers in the world. And later on, he finds his grandfather's cryptology notes...
And the Shaftoes have a tendency toward violence and a gift at ass-kicking. The extraordinary crazy that runs in the family is not something you want to bring up, because you really want them on your side. Unless you outrank them, in which case, feel free to keep telling Bobby Shaftoe to stop mentioning the giant lizard. (It won't do any good.) The same goes for his son and granddaughter,
And in Quicksilver, we meet the Esphahnians, who apparently have no middle setting between declaring a blood feud against someone and adopting them into the family, and are so insane that even Jack Shaftoe (who, at this point, is being literally driven insane by syphilis) comments on it. They're also scarily competent business owners.
Stephenson's version of William of Orange is Genre Savvy enough to recognize that the best people have the weirdest quirks, so he only employs Bunny Ears Lawyers, and he distrusts competent people who have no quirks.
Also by Neal Stephenson, Snow Crash gives us Hiro Protagonist, who lives in a storage container and is neurotically insecure when it comes to women, but is at the same time, one of the best hackers in the world.
And is globally accepted as the world's best swordsman to boot.
Although that one is mostly because he wrote the sword-fighting code for the Metaverse. In reality, he seems to be competent, but the book doesn't make an enormous deal about how good he is with an actual sword.
Dr. Hannibal Lecter is one of the most brilliant psychiatrists in the world and also a cannibalistic serial killer. Averted in that they actually do put him in prison as soon as his "quirk" is discovered, although he continues to write articles for psychiatric publications on a regular basis. The "About the Author" blurb must be a scream.
Never mind being the best sniper in the regiment, he may be the best sniper in the Galaxy, beating even bionically augmented super-snipers who have been blessed by the Chaos Gods...
Also, technically, no-one knows about the hallucinations except him, since he always has the good graces to have them in private. He's still a bit 'off' at the best of times though.
Kurt Kusenberg's Eine Schulstunde is about a school seemingly full of Bunny Ears Lawyers. The teacher brought a living bear to class, the principal would teach William Shakespeare only while disguised as The Bard, and one of the students would speak every A as an I for one month because he lost a bet.
The Artificial Intelligence Personalities in Donna Andrews' Turing Hopper mysteries tend towards this as they develop more self-awareness.
Life The Universe And Everything has His High Judgmental Supremacy, Judiciary Pag, L.I.V.R. (the Learned, Impartial, and Very Relaxed). "He was clearly a bounder and a cad. He seemed to think because he was the possessor of the finest legal mind ever discovered that gave him the right to behave exactly as he liked, and unfortunately he appeared to be right."
Dumbledore: Nitwit! Blubber! Oddment! Tweak! Harry: Is he — a bit mad? Percy: Mad? He's a genius! Best wizard in the world! But he is a bit mad, yes.
Just look at his clothing. Every time it's described, it is more bizarre and clashing. And the school song in Philosopher's Stone.
Half of Hogwarts' other staff aren't precisely normal either. The History teacher is a ghost who doesn't recognize his own students and may not even be aware that he's dead (the only evidence to the contrary being the one time he entered the classroom through the blackboard) and the Divination teacher... doesn't really count as a teacher because most of the time she's talking out of her behind. The Potions teacher is overly dramatic and openly biased against certain students. Oh, and Hagrid's love of terrifying creatures makes him quite suited for the Care of Magical Creatures class. Although most of them (with the exception of Hagrid) aren't particularly odd within wizard society.
And the series actually doesn't use this trope much in the sense that the teachers who are both good at their subject and good at teaching it (like McGonagall) usually don't have any noticeable quirks, at least not anything that is out of the usual.
In the X-Wing Series it seems that Nawara Venn was a Bunny Ears Lawyer who wasn't taken seriously. He's another obvious alien, one who served as a defense attorney in Imperial courts. Of course, being a nonhuman defending people who tended to have perceived or actual Rebel connections meant that he rarely won, so at some point he left to join the Rebellion as a fighter pilot. By the time he took up lawyering again, it was in a New Republic court, where he wasn't seen as strange because New Republic policies aren't blatantly xenophobic.
Azdak the judge, in Bertolt Brecht's The Caucasian Chalk Circle, is a maverick pursuer of poetic justice and a hero to poor underdogs, in whose favour he usually rules. He is an analogue for King Solomon. He is also drunken, horny, rude, violent and so completely in contempt of his own court that he is nearly hanged at one point.
Porfiry Petrovich from Crime and Punishment; while he may act like a buffoon, could run intellectual rings around most of the people on this page. One of the book's longest chapters is dedicated solely to showing us how he nearly manages to get Raskolnikov to confess merely by talking him (and the reader) to death; it's easily one of the most amusing and gripping parts of the story.
Mark McHenry, the pilot from the Star Trek: New Frontier novels. He actively sleeps at his post, for one. But the best pilot there is. Backed up with alien super-powers of course.
In The Hunt for Red October, the Dallas's sonarman Jones is described as eccentric even by navy standards, but is nevertheless very competent.
The Avatar from The Religion War found the technical genius behind the Global Information Corporation by seeking out the angriest, loudest, rudest employee. His reasoning was simply that "anyone with lesser value would have been fired for that sort of behavior."
In The Time Traveler's Wife, despite going missing for days at a time and often being caught naked among the stacks, Henry is allowed to keep his job at the library because he is great at giving talks about obscure literary things. His co-workers were also hanging out to find out the real reason behind his odd behaviour.
Rhino A. Ross (yes, that's his actual legal name) from the John Birmingham books Without Warning and After America who at times refers to himself as if he were actually a rhino, has an unnatural fixation on his biceps (which "You don't get by patting kitty cats"), and in the second book acquires and insists on wearing a Viking helmet. However he managed to achieve the rank of CPO in the U.S. Coast Guard, is a skilled radar and sonar operator, and is every bit as dangerous in a fight as his namesake.
Felix Hoenikker in Cat's Cradle was considered an uncontrollable man by his colleagues. He ground the Manhattan Project to a halt because he decided to stop working on it and instead discover if turtles' spines buckle or contract when they draw their heads into their shells. However, he is an absolute genius, responsible (fictionally) for the creation of the atom bomb, and later Ice-9, a substance that causes the end of the world.
Miles Vorkosigan is hyperactive, manic-depressive, has a stunted body, and shows a fascination with a secret identity that can be seen as bordering on multiple-personality disorder. His own mother acknowledges that he's acted crazy. He once had three consecutive commanding officers thrown into the brig in adjacent cells. He spent ten years as the best covert operative ImpSec had, with a career that included stopping a Cetagandan invasion and enabling another nation to repel its Cetagandan occupiers after they had been invaded (A feat which involved once of the biggest POW breakouts in history). Then he became one of the Emperor's personal trouble-shooters.
His mother is herself a Noble Bigot, and one of the most powerful women in the Empire. Her best friend is an interfering busybody of a mother who also happens to be the Emperor's Protocol Officer, and pretty darn politically influential herself.
Buddenbrooks. Many of the teachers, who have peculiar ways of talking and such. Also, some other characters.
Sydney Carton from A Tale of Two Cities. Even though he's an alcoholic, he's actually a very clever and observant lawyer, even when he's drunk. (During the court case in England, Carton notices that he looks a lot like the accused Darnay, rendering one of the witnesses' testimonies void, since it was primarily based on "I saw him here." He also notices that Lucie Manette is about to faint, even when he's staring at the ceiling. He does all this... while he "smelt of port wine, and did not appear to be quite sober.")
In the early Dr. Seuss narrative The King's Stilts, the eponymous king is up every morning at five, multitasks handling important documents of state with bathing and breakfast, spends the actual working day personally supervising and inspecting every aspect of the kingdom's implausible flood protection systemnote which involves using specially trained cats to chase away birds that would otherwise eat the tree roots which are being substituted for actual levees. Seriously., and at five in the evening every day spends a good hour or so racing around the kingdom on bright red stilts. This is accepted with detached amusement by everyone except his Treacherous Advisor.
In the Honor Harrington series of books, many of the emperors of the Andermani Empire count. Gustav Anderman I was a brilliant strategist and mercenary who believed he was the reincarnation of Frederick the Great and dressed like him. Gustav VI was quietly deposed after trying to make his prized rose bush chancellor, and was succeeded by Gustav VII, one of his sisters who had herself declared a man to stave off a nasty dynastic war between their male cousins. However, the family has a history of being fair and just monarchs who have slowly expanded their empire by rescuing planets in trouble.
Shannon Foraker. Few other officers could forget to use "proper revolutionary titles" as much as she does and expect not to get shot, but her reputation as a "tac witch" and plucky spirit keeps her own Political Officers looking the other way.
narration: Chef Vlad might be loony, but it would be a sad day if he ever left the ship. Or was dragged off kicking and screaming in a straitjacket, as Baz said was more likely.
M. Paul from Villette is a manic teacher who has an awful temper and can be down right abusive at times but at the notion that he is leaving the school students and staff line up to say their farewells to him.