OK, so you have a bunch of different factions who fight against each other all the time. Wouldn't it be so much better if they could all just get along? Unfortunately, that's not going to happen, as they all hate each other's guts.
However, it's said that the enemy of my enemy is my friend. Hence, it follows that if you want to unite people, you must create a common enemy for them to oppose.
This is not for every incidence of enemy factions teaming up against a common threat (Enemy Mine is). This is for cases in which a character deliberately creates a common threat for the warring factions to unite against. A False Flag Operation may help do that, and it can work well when pitched to sides engaging in a Peace Conference, since they've already both proved to be reasonable. Compare Summon Bigger Fish, which usually has less altruistic intentions in mind.
The threat itself is often a Sword of Damocles. A threat from another race — or the appearance of one — can summon up Species Loyalty.
When the common enemy you're creating is yourself, it's a type of Zero Approval Gambit.
The centuries-spanning Gambit Roulette of Aeolia Schenberg from Gundam 00 involved uniting the various factions of the world against Celestial Being.
The Gundam Wing manga Battlefield of Pacifists uses a similar idea. An Anti-Villain former OZ soldier wants to inspire deep space exploration by taking a lost Mobile Doll factory and placing it at Mars, suggesting that a force that powerful would force humanity to put aside their differences and unite to deal with the common threat. He gets killed by a Double Agent, but his actions inspire Wu Fei to become the threat that makes humanity grow, foreshadowing his actions in Endless Waltz.
In Watchmen, the Big Bad plans to force America and Russia to put aside their differences and work together by making it seem as if a massive Alien Invasion is imminent. Whether or not it works on the long run is left up to the reader.
In X-Men, Cable once resurrected Apocalypse as a common threat to unite the fractious mutants.
Gambit once helped him for the same reason. They're both gonna feel like idiots (just before dying horribly) if Pocky ever wins.
Cable turned himself into one of these in Cable & Deadpool. He styled himself as a messiah figure while running his powers at max, knowing the world would revolt against him but hoping that a brief taste of peace would "make them hungry for more". It was working out exactly as planned until Reed Richards called in the friggin' Silver Surfer to take him down.
In What If? v2 #85, "What If Magneto Ruled All Mutants?", Magneto does this to unite the factions of Acolytes battling on Asteroid M.
Camelot 3000 has an interesting version. The newly resurrected knights are not dealing well with each other, so Kai, who was always the least liked of the knights, chooses to remain in the role by acting like an asshole towards the other knights. Thus, he gives the other knights someone common to look down upon and get along with each other.
In Canadian Bacon, the government of the U.S.A. tries to curb economic recession and civilian discontent by renewing the Cold War. When it turns out that Russia is not interested in playing along, the United States government and the media embark on a campaign to unite Americans in a hatred of Canada, of all peoples. Turns out to be a bad idea.
In Miracle this is implied to be the reason Coach Brooks is so hard on his players - if they're united against him, they "won't have time to fight each other."
In Watchmen: This is the ultimate plan of Ozymandius to prevent nuclear war. He frames Dr. Manhattan for the destruction of New York City, uniting the world against a fictional super-human threat.
The Trope Namer is Genghis Khan as presented in the Conqueror books, who pulls off an epic, two-way gambit. He starts off by spending the winter raiding Tartar camps so that when spring comes, all the Tartar clans unite to crush this annoyance. He then uses the threat of the united Tartars to unite the Mongols into a single nation, with himself as khan.
In The Man Who Used the Unverse, by Alan Dean Foster, what turns out to be this gambit on a galactic scale is one of the final stages of the hero's ultimate plan.
Romance of the Three Kingdoms: Yuan Shao wanted Han Fu's territory because it was a source of food for his army. First, he sent a letter to another warlord, Gongsun Zan, proposing that they both attack Han Fu and split his territory. Once Gongsun was on board, Yuan sent a letter to Han Fu, warning him that Gongsun Zan was coming to attack him and that he should accept Yuan as a protector. Han accepts this, at which point Yuan uses his new position to strip him of all real power. When Han realizes he's been had, he flees to Cao Cao's service.
Dune: One major theme among the many ploys of Emperor Leto II Atreides. Foreseeing great troubles for humanity, he took it upon himself to unite and prepare them... by becoming the single worst oppressor and tyrant in the galaxy. When, after several thousand years, he thinks it worked, he gladly allows one of the billions of plans to assassinate him to succeed. In a manner he chooses.
Illuminatus!: Among the (many, many) conspiracies is that the government(s) use this to keep the populace distracted from their own sinister agendas. A character is told to watch China after the USSR falls.
Ursula K. Le Guin's The Lathe of Heaven uses the threat of aliens to unite the nations of Earth.
1984: Global power blocs Eastasia, Eurasia, and Oceania are locked in constant war. The alliances between the three change so that one state can never become too powerful and dominate the others. This is an understanding between the three powers that's been ongoing for decades. The real objective is to provide a focus for their own citizens' hate and Patriotic Fervor — to unify them, and control them. Thanks to doublethink, most people, apparently including the ones in charge, believe they were always at war with whomever they're at war with at the moment, so they remain passionate despite the alliances changing all the time.
Played with in the Belisarius Series. Khusrau the Persian Emperor organizes a Pan-Persian crusade to conquer the Malwa Empire and retake the lands of Persian epics. As they were already at war with Malwa anyway, it wasn't hard to do. Khusrau admits that if he had to, he would attack Rome (his ally at the time) rather than allow a civil war. But this was more convenient.
In an episode of Andromeda, Dylan is being chased by members of the most powerful Nietzschean clan while transporting another Nietzchean from a rival clan to a wedding with another rival clan. However, she's actually on a mission to assassinate her intended groom. Dylan instead draws the big bad clan out into combat with members of both the other rival clans, forcing them to join together. Thus, the Sabra-Jaguar Clan is born and the Drago-Kazov Clan is no longer the biggest bully in the playground.
In The Outer Limits TOS episode "The Architects of Fear", a group of scientists turns a man into a fake alien and has him "invade" the Earth in an attempt to scare the nations of the world into cooperation.
On a more minor scale, Dr Kelso from Scrubs takes the role of common enemy in the hospital. In one episode, he notices that the staff of the hospital falling into a series of petty disputes and arguments, so he deliberately makes some very visible and unpopular decisions to turn everyone's anger onto himself. He does because they are so busy arguing that they aren't doing their jobs, and the patients are suffering.
Jeeves and Wooster: Jeeves uses this to end the quarrels between Wooster's friends. He tricks Wooster into ringing the alarm bell, thus bringing everyone outside into the pouring rain, where they find out that the door is locked from the outside and they don't have the key. When asked why Wooster rang the alarm bell, he can't give a straight answer, and Jeeves makes him go to somebody else's house to find the key. This gives everybody else the opportunity to unite in anger against him, after which Jeeves "discovers" that he had the key in his pocket all along. When Wooster finally comes back, everybody else just laughs at him for having biked a mile in the pouring rain for absolutely nothing, and forgets that they were angry at him.
In the final episode of Generation Kill, Sergeant Major Sixta reveals that he's been doing this to the battalion the entire time with ridiculous enforcement of the grooming standard to give the Marines an outlet for their stress.
Played for laughs in an episode of Sister Sister. When the girls and one of their friends are all at each other's throats, Lisa takes it upon herself to give them a common enemy. She annoys them enough that they're all friends again within minutes.
Cutler's plan in Being Human revolves around destroying the facade the vampires have created to hide the supernatural from mortals, then using propaganda to paint the werewolves as the greater evil and convince ordinary humans to side with the vampires.
Employed by the teacher on Head of the Class, on the theory that he can reunite his fractious class by getting them all angry at him and immediately revealing that it was a trick.
In the 30 Rock episode "Winter Madness", Jack and Liz discuss this trope. Liz realizes that her problem with her staff is that they all view her as their common enemy. Therefore, she invents a fictional executive named "Dale Snitterman" to blame everything on. Unfortunately, it turns out there's a real executive with that name, so it ends up with Liz's staff storming the office of someone who has never heard of them.
Wicked: The Wizard explains to Elphaba that this is what he was doing by making everyone believe the Animals are evil. This is a metaphor for Adolf Hitler.
Averted in Warhammer 40,000. Despite all the prerequisites, that is a number of horrible galactic threats of all colors: hordes of Ax-Crazy barbarians, Legions of Hell, omnicidal implacable robots, and all-consuming alien locusts — nothing seems to be able to divert the three more reasonable powers from each other's throats. Each power is also riven by internal conflicts.
Notice the operative word there — "...the three MORE reasonable powers..." Assuming the former troper was referring to the Imperium (which will not tolerate ANY xenos under ANY circumstances), the Eldar (who are willing to kill planetloads of non-Eldar just to save one Eldar in ten thousand years' time), and the Tau (who actually are fairly reasonable, in that they are willing to ally themselves with other non-hostile species, but are weak and tend towards being less-than-nice to, well, EVERYONE who isn't an Ethereal), then one can understand why no Galactic Alliance has been formed.
Someone actually tried this once in 40k. It ended up with their entire race being sealed into robot bodies with most of their emotions stripped away going slowly insane in stasis when they picked on a Greater Enemy who was greater than their entire disparate race then made a deal with the (other) devil to survive.
Played a bit straighter in Warhammer; the more northerly Forces of Order (the High Elves, theEmpire, Kislev, and the Dwarves) are perfectly happy to team up when the Norscans get their act together and invade, but they're perfectly happy to go back to stabbing each other when the imminent threat disperses.
Played somewhat straight in BattleTech. The Word of Blake, a religious Knight Templar faction, initially started the Jihad due to unfocused, inchoate rage against the Great Houses, since the Houses ended the Second Star League (it was utterly ineffective) and rendered Blake's prophecies on the matter null and void. The Blakists soon realize that they've attacked most of the rest of humanity, and eventually decide to make the most of it by becoming a foe so terrible that the Inner Sphere as a whole will have to unite against them. For the most part, it works.For a while.
Starcraft: The Confederacy plans to secretly allow the Zerg to rampage fringe planets as an incentive to keep dissenting colonists in line. Later, Mengsk adopts the same plan and uses it to unite the various factions into a single empire, under his own thumb. Then Kerrigan enters the picture... and uses the UED to ally herself to the Protoss, only to betray them. Then she strengthens the UED in order to get Mengsk, Raynor, and Fenix to join her against them, before betraying them too. Finally, in a bit of irony, Kerrigan becomes the "common enemy" that the UED, Dominion, and Protoss unite against. However, they aren't nearly as successful.
Knights of the Old Republic 2 revealed that Revan's plan was to conquer the Republic by attacking key points, while leaving the infrastructure intact and recruiting his (or her) strongest enemies. Thus, a galaxy united under Revan's rule would be more than equipped to turn to face the external threat of whatever he encountered out in the Unknown Regions. Malak, of course, royally screwed the pooch by spoiling the plan and engaging in much more random destruction.
The Old Republic and associated media make Revan's plans even more labyrinthine, in terms of motivations. Initially, Revan and Malak are sent back to the Republic as a vanguard force for the exiled Sith Empire. At first, they do their job dutifully, until they decide, as Sith often do, to rule for themselves. Thus, the initial assumptions that Revan's tactics were altruistically meant to prepare the Republic against the Sith Empire are actually not quite correct. They were meant to properly prepare his own Empire against his master's. Malak tossing a Spanner in the Works ironically becomes the one thing which redeems Revan and, arguably, saves the Republic. There is a ton of Unreliable Narrator and Depending on the Author at play here as well.
Super Robot Wars: Original Generations: This is Bian Zoldark's hidden motivation (and the game that inspired the story arc, Super Robot Wars 2). He organizes the Divine Crusaders in a bid to conquer the world, figuring that either he will unite the world's powers against an alien threat — or the world's powers will unite against him, either way being better prepared for the invasion to come.
He uses a double-layered version of this trope. He's able to create the Divine Crusaders in the first place thanks to a False Flag Operation where one of his agents provoked the aliens during a secret Peace Conference, then wipes out both forces. He then broadcasts a speech making it look like the aliens attacked government forces that were planning to surrender to them. So he makes the aliens look like the bad guys so he can unite his forces into being the bad guys to unite the world against the aliens that actually are the bad guys and then the aliens at the peace conference turn out to be a different race conveniently disguised as the bad guys and oh god it's so confusing when it's compressed like this.
Wild ARMs 2: Irving Vold Valeria finances the terrorist group Odessa specifically so he would have an excuse to make ARMs an international strike force to better combat a different threat later on. It should probably be noted that he was also willing to use Odessa for this iftheywon.
Final Fantasy Tactics A2 provided a very unintentional version of a Genghis Gambit. One particularly rich individual wanted to start a construction project in the Rupie Mountains and sent various hired hands like House Bowen to evict those clans who refused to step aside. One of the big attractions in the Rupie Mountains is the heated rivalry between the Bangaa Brotherhood and the Nu Mou Nobles. Guess what this individual, via House Bowen, wound up ending thanks to intervention by Clan Gully?
Modern Warfare 2: Played terrifyingly straight. General Shepherd deliberately incites a shooting war with Russia in order to instill patriotism, incite volunteers to the military, and unify America. If this sounds a little anvilicious, it comes across that way in the game, too. The death screens even warn about the dangers of excessive patriotism.
Two of the endings in Blood Storm have this happen unintentionally. Razor unites the planet by leading a vengeance-fueled genocidal campaign against Cyberia, stopping the supply of weapons coming from that province while making the rest of the alliance stronger. Tempest, on the other hand, accidentally reveals she started the whole mess, and all eight provinces unite in hunting her down for her execution.
Discussed and averted in Heroes of Might and Magic IV. A Genre Savvy necromancer rejects a perfectly reasonable plan to conquer one of the newly-emerging nations of Axeoth and rule it along with his own kingdom, because he doesn't want to become the enemy that the rest of the world unites against.
In Assassin's Creed I, Robert De Sable attempts to persuade King Richard to form a truce with the Saracens and unite against the Assassin Brotherhood, since Altair is responsible for murdering several prominent citizens on both sides of the conflict.
Apparently the reason why Tavor was made immortal in Looking for Group, so he could unite the enemies of Kethenecia into one imperialistic force that would attempt to conquer the northern tribes, who Cale could rally into rebuilding the ancient city.
He created a more complicated plan involving a coalition of Men Behind Men working to create three empires instead of one, that are actually working together to stay unified.
He does use it on a smaller scale as well as part of that unification plan, using the threat of the other conquering nations to pressure smaller states into capitulating into his empire for their own protection. What they don't know is that his companions control those other major nations and are doing the same thing to gradually absorb every independent state in the region.
Reporter: So... nations can attack each other with no risk of nuclear annihilation?
Well-Meaning Failure Man: Uh...
King of the Hill: Bill becomes the emergency marshal of the local flood shelter and turns out to be a competent and well-respected leader... by blaming Hank for everything that goes wrong and eventually locking him up. Technically, the whole flooding of South Arlen -was- Hank's fault. But Bill had to go and muck it up by keeping everyone effectively imprisoned in the shelter by letting them believe the flood had not yet ended... when it actually had.
Trope Namer: Genghis Khan, who went on conquests to unite the Mongols. Cracked.com described it as something akin to a massive work team-building exercise.
This was Otto Von Bismarck's favorite trick. To unify All the Little Germanies into, well, Germany, he made Denmark look like an aggressor, then manipulated Austria into attacking Prussia, then France into attacking everyone. When the dust settled, Prussia had doubled in size by unifying with many of its small neighbours, France was humiliated, Austria was broken, and Denmark lost a large chunk of land.
This is the standard operating procedure of fascism: The leaders instill in the people a strong nationalistic pride and militaristic culture, usually hearkening back to the old days when almost everyone fought each other, and then finds an enemy (external or not) and uses them to unite the people, stating that it is either you are With Us or Against Us.
Used during the first world war by T.E. Lawrence to unite Arabic tribes. The English army was trying to fight the Turkish Empire, but Lawrence's goal was to create a pan-Arabic nation. Though he did not succeed, he did set the history for the future independence of Arabs from Europe.
One theory is that the entire Arab-Israeli Conflict is, at least in part, the result of Egyptian President Gamal Nassar trying to do this to the entire Arab World. He hoped that by painting the newly formed State of Israel as a common enemy of all Arabs, he would be able to unite the different regional, political, and religious factions under one banner. Unfortunately for Nassar, the plan failed, and the situation has since taken on a life of its own.
Romanian ruler Mihai Viteazul did this as a necessity, as enemies were tearing the country apart in regions. With the rest of them being somewhat subjugated to foreign rulers, he united them by force and succeed, but only for a brief time. Centuries later, Ioan Cuza would do it in a more peaceful and in-accord way, which lasted to this day.
This was Hideyoshi Toyotomi's strategy in the 1590s to unite the feuding warlords of Japan: invade Korea and China and let them deal with their carnal fury. They didn't make it past Korea.
Part of the reasoning behind Drill Sergeant Nasty. Even if none of the 40 guys in any given platoon can agree on anything else, they can all rally behind the idea that the bastard sergeant needs to die a slow, painful, and embarrassing death.
This was the main reason for the early Crusades. The struggle of a common cause was intended by the Church to burn away the petty resentments between the Christian lords of Europe, and the land seized was to allow estates for spare sons.
North Korea keeps its people in line by uniting them against nothing less than the entire rest of the world (though mainly South Korea and the United States). As of March 2013 they seem to be uniting everyone else against them, since even China is agreeing to enforce sanctions against them now.
U.S. Secretary of State William Seward thought that a Genghis Gambit against France, which had just established a puppet dictatorship in Mexico, would unite the Union and Confederacy and avoid the Civil War. No one else bought the idea.
Crops out once in a while during the long process for the unification of Italy:
First it was Carlo Alberto, king of Sardinia, to successfully paint Austria as the common enemy of all Italians, leading a coalition against them in the 1848 war. It ultimately failed because the Pope and the king of Two Sicilies didn't buy it and ultimately decided to recall their troops and leaving Sardinia to fight alone (it helped they had not officially declared war, thus painting the commanders as rogues);
Between the 1848 and 1859 wars, the Count of Cavour (prime minister to king Vittorio Emanuele II, Carlo Alberto's successor) almost succeeded in doing it and creating a confederation where Sardinia would become a Kingdom of Northern Italy and the Two Sicilies would become a Kingdom of Southern Italy, with the two countries conquering the rest of Italy and Austria as the enemy. It ultimately fell through when the king of Two Sicilies asked what about the Pope and found out the original plan, calling for three kingdoms with Central Italy and the confederation led by the Pope, had been discarded upon Papal rejection;
After that, Cavour conspired with Napoleon III to unite Sardinia, the Italian patriots and the Second French Empire against Austria. This time they succeeded, leading to some progress on the unification;
the transformation of Sardinia in the Kingdom of Italy came after another successful round from Cavour, this time by presenting Garibaldi's conquest of the Kingdom of Two Sicilies as the common threat to both Sardinia and most of Italy to get Britain and Austria to let him conquer the dukedoms of the North, most of the Papal States and the Two Sicilies and the king of Two Sicilies as the common threat to his own subjects so they'd allow Garibaldi to conquer them (Garibaldi was on the plan);
Italy was allied with Prussia when Bismarck manipulated Austria into attacking them, and managed to conquer Venice;
failed and then succeeded by accident during World War I: Italy tried to paint Austria-Hungary as invading barbarians ready to Rape, Pillage, and Burn to motivate the soldiers (who still identified more by their region of birth than as Italians) into fighting, but they didn't buy it (partly because they could see they were invading Austria-Hungary), but then, after the rout at Caporetto, they saw the civilians (who had bought the propaganda) running from the Austro-Hungarians (who were now actually invading), and rallied together as Italians. One year later, the Austro-Hungarian Army was annihilated as a fighting force and, by the time it had regrouped from certain doom, the Austro-Hungarian Empire had collapsed.
A reverse Genghis Gambit of sorts with respect to the "Boxer Rebellion" occurred in China in 1900. In response to both actual foreign imperialism and cynical propaganda from certain palace factions, xenophobic/nationalistic Chinese mobs began attacking any and every foreigner they found, regardless of nationality. This led to all foreign nations with interests in China banding together to deal with this shared threat, despite being rivals or worse in their normal relationships.