The term "Mary Sue" (and its male counterpart, "Gary Stu") typically refers to idealized characters that seem to function principally as wish-fulfillment fantasies, implying one-dimensionality, and a narrowed range of dramatic possibility.1 It is also generally regarded as pejorative, and the proclamation of a character as a Sue or a Stu widely taken for an attack.
Still, Sues and Stus are pervasive in fiction, across the media spectrum. After all, a writer putting a version of themselves, but better, to paper is likely to be well inside Sue/Stu territory. The same goes for a writer creating an idealized figure with which they hope to make their reader identify in such a way. A writer setting out to create a character which is a role model, a "positive counterstereotype," or anything else of the kind has to be very careful indeed if they don't want to cross that line.
One may go so far as to say that the Sue/Stu is a default mode for fiction, so standard in some stories that we barely notice their Sue-ness. After all, what does the average television show offer? Attractive people saying polished, scripted things, usually while wearing nice clothes and sitting in handsomely furnished rooms. The world of the TV professional--the doctors and lawyers who give the impression virtually no other kind of work exists--tends to be a fantasy of competence and glamour, with most of the ethical rough edges rubbed off. The TV physician or surgeon is always brilliant, and always deeply concerned with the care of the patient; the worst that can be said of them is that they're cranky or eccentric, like John Becker (Becker) or Perry Cox (Scrubs) or Gregory House (House), and even that crankiness is often presented as part of their excellence--for instance, in their demanding the best from their subordinates, or their willingness to buck the system to save a life. From the deadpan Law & Order to the strutting, speechifying (and surprisingly musical) inanities of David E. Kelley-produced dramedies like Boston Legal, the TV attorney is little different, and usually better dressed, their well-cut suits rather more becoming than surgeon's scrubs.
It's not a real doctor or lawyer viewers are seeing, but the fantasy version of what they do and how they live--and it may well be that some write their Mary Sues and Gary Stus defensively, to forestall the "minority pressure" (to use Ray Bradbury's term) that would descend on them if an influential group (such as doctors and lawyers happen to be) were to be offended by a more realistic depiction.
Leave aside the upper middle-class vision of life predominant in TV drama for a moment, and consider the action hero instead. Most of these have been the author's Gary Stu. Robert Howard had Conan, Ian Fleming had James Bond, Clive Cussler had Dirk Pitt, and Tom Clancy had Jack Ryan and Mr. Clark. Ex-Navy SEAL Richard Marcinko was his own Gary Stu, picking up where his autobiography left off with a series of action-adventure novels--and even a first-person shooter--in which Richard Marcinko himself is the star. Such characters are smarter, stronger, tougher, braver and generally better than ordinary people because they have to be; they wouldn't survive what their authors put them through otherwise. (It takes a cartoon character to make it in a cartoon world.) Very often they have ridiculously large portfolios of skills, because it's the only way the writer can keep them at the center of the plot, moving it along, rather than having to cede the spotlight to other characters.
In fact, outright geniuses in all fields are a dime a dozen, and their intellectual feats--the lightning-fast hacks of computer systems they've never seen before; the immediate improvisation of effective on-the-spot solutions to world-ending crises; the overnight, single-handed creation of futuristic inventions that in real life defy the scientific-industrial complexes of the most powerful countries on Earth--bear about as much relationship to the capabilities and accomplishments of real-life geniuses as the physical feats of comic book superheroes do to those of the greatest athletes. (I suspect few appreciate the latter, though. Unbelievable as it may seem, the idiocies of Eureka's scripts reflect a widespread view of how scientific R & D actually goes, and there are actual working engineers who lament their employers will never give them the chance to be Reed Richards.)
In short, Mary Sues and Gary Stus do have their weaknesses, especially when judged by a standard of realism and character drama, but they certainly have their uses and their places, which is why writers write them, and why so many readers gravitate to them (or at least, stories featuring them). Unfortunately, writers don't always recognize those uses and places, and make a botch of things by placing them in an inappropriate context--or simply by writing the character badly.
The truth is that a good Sue/Stu is just as tough to write as a more realistic character, and perhaps even tougher. It's not easy to make such characters likable, let alone relatable. It's not easy to sustain suspense when the hero's unbeatable and indestructible. And all too often, the execution ends up lacking subtlety, or nuance. The writer pushes things too far. We end up with a character who is not just a talented winner, but someone who is talented at everything, always right, always gets the last word, always one-ups everyone else, always gets away with everything, is always being fawned over for their abilities and general wonderfulness--and it's quite a feat to keep this from getting wearisome in a hurry, one that exceeds the skill of many an author. In other cases they make the character a surrogate for their nastier impulses. We end up with a braggart, a jerk, a bully or worse, and so we sympathize, and empathize, with the people who have to put up with them instead of our ostensible protagonist.
Nonetheless, even in the best of cases, the plain and simple truth where fantasy is concerned is that we don't all have the same fantasies. Quite the contrary, others' fantasies very often touch our insecurities, our bitter memories of rejection or failure, our deepest, pettiest resentments and antipathies; we can experience someone else's wish-fulfillment as an assault on our own wishes, and even our own being (and it must be admitted, a Sue or Stu is sometimes conceived as exactly that, the wishes to be fulfilled by them not pleasant for others, or the Other). And at the same time, we can be irrationally offended when someone criticizes our favorite Sues and Stus.
In principle, there's no reason why one can't enjoy their own Sues and Stus, recognize the right of others to the same, and still be annoyed by particular fantasy characters, still call characters what they are, and respond appropriately to genuinely pernicious Sues and Stus. Alas, the elevation of gut feelings to moral principles by identity politics, and all the irrationality and hypocrisy and viciousness that go with this has made the unavoidable wrangling about Mary Sues and Gary Stus far more bitter than it has to be, so that in many a situation one hesitates even to verbalize the identification. (Call it the "politics of personal fantasy.") It's yet another way in which real life is unkind to fantasy--and unalloyed fantasy, a thing one shares at their own risk.
1. The 1974 short story "A Trekkie's Tale" (available here), actually a parody of the tendency in fan fiction about Star Trek, is the source of the term.
Book Review: Providence by Max Barry
4 hours ago