Ballot stuffing.
Of course, some degree of this happens for every election in a large enough city or state. The question is whether it's widespread enough to truly influence the results of the election. Still, expect the losing side to cry foul play even in relatively clean elections. This trope occurs frequently as an example of Dick Dastardly Stops to Cheat, when the winning side does it even when they would have won anyway. One variety involves "ghost voting," which is where people stuff the ballot box with the names of people who had in fact died sometime before the election, usually those who were recently deceased. This variant in particular is often associated with the city of Chicago, leading to jokes about Chicago being a place where people come back from the grave to vote.
This should not be confused with a Military Coup, which is where the military of a country or some elements of it attempt to remove the current leader by force.
Killoran: Monk's already won by three thousand more votes than there are voters. Boss Tweed: Only three? Make it twenty, thirty. We don't need a victory. We need a Roman triumph.
Tom: I ought to, I voted for him six times last November.
Mayor: And that's not even the record.
Electiondoes this in reverse. While counting ballots, Mr. McAllister throws two votes for Tracy in the garbage in an attempt to deny her the victory.
Mentioned in An American Tail where the drunken Irish (mouse) Mayor of New York City attends the funeral of another mouse and notes that he was too young to vote, "But he'll vote from now on" and puts his name in a book of "ghost voters".
Considering that said mouse ("Honest" John) was a pretty obvious reference to the Tammany Hall political machine, it makes perfect sense.
The trope name served as the tagline to John Sayles' corrupt politician comedy Silver City.
The title character in The Great Mcginty first comes to people's attention when he votes for the mayor 37 times. Of course, he only did it on the promise he'd get paid $2 for each vote, but still.
Literature
There's a section about this in one of the Sten books. It gets disrupted by 'Raschid', in a rather hilarious manner. 'Raschid' is actually the Eternal Emperor, and being several thousand years old, has rather more experience with politics and corrupt elections than anyone else.
Hope Was Here: Hope works on the mayoral campaign for an underdog candidate. After her candidate loses the election, Hope looks over a list of voters and spots the name of a curmudgeonly man who had loudly insisted that he never voted. When she goes to congratulate him on turning out for the election, he insists that he didn't. She turns up enough discrepancies like this to force the incumbent mayor to resign.
Homeless drifter Puggy is recruited for this in Big Trouble along with a collection of other lowlifes. The are brought to the voting center(s) and told for who to vote in front of the ballot officials, who don't bat an eye. Of course, all this happens in Miami, and political corruption is a major part of the book.
When the Dark Lord decides he wants to win by election in Grunts!, General Ashnak and his orc marines decide to help matters along a bit, just in case the Supreme Power Of Evil can't win over the population with his speeches.
This is part of Chris' plan to humiliate the title character in the book and film Carrie. Her friends on the prom committee will throw out the votes for the king and queen of the prom and stuff the ballot box with votes for Carrie and Tommy, and when they take the stage to be crowned, Chris will dump a bucket of pig's blood on Carrie's head in front of the whole school. It works exactly as planned, with the exception of one minor, overlooked detail — Carrie had telekinetic powers, and now she had reason to use them.
Salem: "A lot of dead people voted that year. Twice!"
In one episode of Blackadder the Third, Blackadder filled in for the single voter of a rotten borough and apparently placed several thousand votes for Baldrick.
In the same episode he sarcastically comments on the system that allows this to happen: "Manchester. Population: 60,000. Electoral roll: 3"
Played for Laughs in a Family Ties episode when a girl reveals her crush on Alex by telling him that when he ran for student council president, "I voted for you. Three hundred times. Sorry you didn't win." Later, his best friend Skippy makes the exact same confession.
Played with in a Parks and Recreation episode. They select the name of someone out of a hat to decide who has to do an unenviable task. It turns out everyone puts in Jerry's name rather than their own.
This is a common accusation levied towards realitygame shows that rely on audience voting.
American Idol is one of the most common targets of this in the US, especially due to the fact that people are indeed allowed to vote as many times as they want. A number of people have exploited this by employing "robo-calls" and "power-texting" to make thousands of votes — completely legal under AI rules, and often balanced out by different robo-callers voting for different contestants. What pushes the show into this trope, however, is a series of controversies over the fairness of the voting, most notably an incident in the season 8 finale involving AT&T (one of AI's sponsors) that may have cost Adam Lambert the victory. See here for more.
In 2006, Stephen Colbert reported that Hungary was holding an online naming poll for a new bridge, for which the then-leading entry was the "Chuck Norris bridge". He then proceeded to suggest that his fans should stuff the ballot box with "Stephen Colbert bridge". Hilarity Ensued when it Went Horribly Right and "Stephen Colbert bridge" won with over 17 million votes - about 7 million more than the entire population of Hungary.
He tried again when NASA announced that it would put a particular name on a capsule intended for the International Space Station based on the number of votes. "Colbert" won in a landslide, but was denied victory. Instead, NASA shipped up a new piece of equipment, which has the acronym C.O.L.B.E.R.T.note Combined Operational Load Bearing External Resistance Treadmill Stephen was mollified.
In Boardwalk Empire the corrupt politician and gangster Nucky Thompson is genuinely worried that his candidates will lose the election despite engaging in all the usual dirty tricks. He is not powerful enough to outright steal the election and the opposition is doing its own ballot stuffing. In season 2 his enemies use this to get him indicted for voter fraud and he faces jail time.
Inverted in Skins - Harriet and Doug only count the class president votes for Naomi and Crispin, knowing Cook received the most and not wanting him to win. However, Naomi secretly witnessed the decision, and when they declare her "the winner," she pulls Cook's ballots out of Harriet's bra in her Crowning Moment of Awesome.
Narrator: Don't you know you're wanted in Chicago?
Tom Servo: For voting twice?
In Justified the standard version is averted since the citizens of Harlan County are savvy enough that you cannot steal an election by stuffing the ballot box. Instead the candidates have to resort to other dirty tricks like bribing voters with alcohol and sexual favors, rigging debates by bribing the moderator and having the opposition disqualified by framing them for car bombings, drug dealing and nepotism.
In season one of Boss Tom Kane's chosen candidate for governor is projected to lose the primary but Kane is not going to let that happen. He starts calling in favours and making deals with local ward bosses. A massive sabotage and misinformation campaign ensues where the other candidate's campaign sings are stolen and his supporters are directed to non-existing voting locations. There probably is no actual ballot box stuffing but the effect is similar.
In one episode of Grange Hill, a student helping to tally the votes in a student council election is introduced to the concept of 'spoiled ballots'. He then proceeds to destroy a large number of ballots in an attempt to grant his favoured candidate the win. He is found out because his number of spoiled ballots is so much higher than any other tallyer.
Jack: Why should I even bother to vote? New York will go for Obama even if I voted a hundred times, instead of my usual five.
In ''Copper, set in 1860s New York City, had one character in charge of giving out alcohol, wigs and fake names to all the 'frequent voters' to help 'Irish' Jake McGinnis win.
In Scandal a major plot point is that the US Presidential election was stolen by hacking the control cards on voting machines. The matter is complicated by the fact that the winning candidate was not aware of the fraud and actually sees it as a personal betrayal.
"The votes are in. I've been elected to the position of supreme ruler of Earth. I won in a landslide, thanks to low voter turnout and the fact that I voted for myself many times."
Theatre
The election night newsreel in Of Thee I Sing shows John P. Wintergreen casting multiple ballots for himself. When he needs only four more votes to win, he casts all of them. No wonder his defeated opponent charges him with voter fraud in 7 states.
Video Games
In Tropico, the electoral tribunal can interpret a fraction of opposition... er misprint ballots as votes in favor of "El Presidente". The fraud has some minor drawbacks but it is rarely needed outside the first game.
While there are no opportunities to follow the letter of the trope in Fallout 3, there is an opportunity to manipulate election results to help the candidate you want win (it just involves removing votes for the other candidates) in the Republic of Dave. Given that the current president (Dave) has some rather questionable policies and electoral rules in place, you may even feel morally justified in doing so.
Webcomics
Prickly City disdains this. The dead voted for Kevin, but only once. It's not Chicago after all.
Western Animation
The Simpsons where Sideshow Bob wins the mayoral election through votes cast by those in the cemetery, including the pet cemetery. Finding Snowball I's vote for Bob prompts Lisa to say that this time, It's Personal.
Bart: Hey! Uh, he did try to kill me!
It should be noted that the episode strongly implied that he would have won against Quimby anyway, as both Homer and Krusty casted their votes for Bob, and the image of Quimby looking drugged out and like Satan did not help his chances at election (the drugging up was actually intended to be for Bob, but either Bart and Lisa apparently mixed up the candidate rooms, or Bob was genre savvy enough to see it coming and switched rooms at the last minute).
Bart was also implied to have somehow casted his vote for Krusty to become the Congressman for Springfield despite being 10 years old and thus ineligable to vote.
Also inverted once: When Homer's high school principal discovered that Homer won the election, he had Lenny and Carl hide the ballot box containing the actual amount of votes because he didn't want Homer to win.
The reason that he didn't want Homer to win was because he'd heard some of the popular students planning to vote for Homer to be Prom King, then laugh at him when he got up on stage. He faked the result against Homer to save the guy from the humiliation.
Also, Homer once won for being king of the parade. Unlike most examples, this was actually part of a dire plot to have Homer assassinated. Sideshow Bob attempts to warn Homer that he only won because someone (most likely Homer's assassin) stuffed the ballot box.
Eddy in Ed Edd N Eddy tries it when he runs for "king of the cul-de-sac", but Edd anticipated that and replaces the real ballot box with a fake one.
An episode of DiC's Care Bears has Professor Coldheart employing this tactic to win the Mayor-for-a-Day election, promising "a holiday for rules".
Richard J. Daley, the mayor of Chicago from April 20, 1955 up to his death in December 20, 1976, is the Trope Namer.
Tammany Hall in New York City in the 19th and early 20th centuries were notorious for this and other forms of political corruption, especially under Boss Tweed in the mid-19th century.
John F. Kennedy's close victory over Richard Nixon in the 1960 Presidential election was discovered to have ridden on some of this, most famously with the dead coming back to vote in Chicago. However, Nixon decided to allow him to win anyways, partly to show himself as a Graceful Loser and partly because the Republicans also engaged in ballot-stuffing (which would've been revealed if they'd gone after the disputed votes for Kennedy)note The aforementioned Mayor Daley of Chicago commented that "one of their precincts, outside of Peoria, where there are only 50 voters, just announced 500 votes for Nixon.".
This trope was part of the reason behind the Costa Rican Civil War from March 12-April 24, 1948. To put it simply, there was an election, after the election, around the 1940s. Eventually they try to annul the election because of suspicions that opposition candidate Otilio Ulate won via fraud.
It's well known that several People's Republic of Tyranny countries sometimes utilized this to ensure that someone won the election.
Josef Stalin once mentioned that it matters not who votes in an election, but rather, it matters who counts the votes when commanding his officers to do an implied instance of stuffing the ballot boxes.