Eye of the Moon Plan

The was created by Madara Uchiha as a way to bring peace to the world. Though its execution does not go according to plan and some furthered it for their different personal motivations, the end goal remains the same for all involved: projecting the Infinite Tsukuyomi on the moon in order to trap the entire world in a dream, thus saving mankind from destroying itself but also at the price of robbing free will from the entire world. However, due to being a plot by Black Zetsu, it was actually meant to bring back Kaguya Ōtsutsuki and turn the people, trapped within Infinite Tsukuyomi, into a White Zetsu Army.

The Plan in Theory
From a young age, Madara Uchiha wanted a peaceful world where nobody — particularly his loved ones — would need to die. In his adulthood he founded Konohagakure alongside Hashirama Senju in order to create this desired peace. Konoha quickly developed a predominately Senju-government, which Madara felt would inevitably lead to the mistreatment of his Uchiha clan; for this reason he decided Konoha failed in its goal of peace. He began studying the Uchiha's Stone Tablet and, from what he could decipher, he learned of the God Tree, the Infinite Tsukuyomi, and how a godly power could be acquired through union of the Senju and Uchiha.

Madara told Hashirama about his new dream, and then left the village. Subsequently, the two fought at what would become the Valley of the End. Madara was believed to have died, but he instead went into hiding, taking with him a piece of Hashirama's flesh. He integrated it into his own body and, decades later, awakened the Rinnegan. With the Rinnegan he summoned the Demonic Statue of the Outer Path from its storage on the moon, and from it he cultivated White Zetsu. Now that he had the means of peace at his disposal, Madara began formulating his Eye of the Moon Plan in earnest: he would collect the nine tailed beasts into the Demonic Statue in order to reform the Ten-Tails, which he would then become the jinchūriki of in order to cast the Infinite Tsukuyomi, thus ending all conflicts while also erasing or rather destroying free will in the process.

Madara realised he could not complete his plan during what remained of his natural lifespan. He implanted his Rinnegan into a young Nagato so that their power would not be lost upon his death and so that Nagato could someday restore Madara to life. In order to manipulate Nagato to that outcome, Madara would need an agent to act for him on his behalf; he connected himself to the Demonic Statue to keep himself alive until such a person could be found. During the Third Shinobi World War, Madara discovered a badly-injured Obito Uchiha, who he believed would suit his needs. While treating Obito's injuries Madara secretly branded Obito with a Forbidden Individual Curse Tag so that Obito would never act against his wishes. Once Obito recovered, Madara manipulated events so that he witnessed the girl he loved being killed by his best friend and childhood rival, thus breaking Obito's ties to others and giving him a reason to want the Infinite Tsukuyomi carried out: to create a world where tragedies like the one that befell him would not happen.

With Obito having been corrupted to his liking, Madara shared with him all he knew: of history, the secrets behind certain techniques and abilities, and whatever other steps Madara had already taken. He left Black Zetsu for Obito, believing it to be a manifestation of his will that could guide Obito after he was gone and, if necessary, force the completion of Madara's plans. Madara then disconnected from the Demonic Statue and, before dying, entrusted Obito with his possessions, his plans, and his name until such time that Madara would be brought back to life. But Obito did not trust Madara and as such had no intention of ever bringing him back. He would follow Madara's plans, but it would be himself, not Madara, who became the Ten-Tails' jinchūriki and performed the Infinite Tsukuyomi; Nagato's purpose would be to revive Obito in case anything happened to him before then.

Unbeknownst to Obito or even Madara, Black Zetsu had its own motives. Rather than being a manifestation of Madara's will, it was actually a manifestation of Princess Kaguya Ōtsutsuki's will, having been created before her defeat by the Sage of the Six Paths and his brother centuries ago. Since then, it had been trying to create a Rinnegan user so that the Infinite Tsukuyomi could be used and Kaguya could be brought back to life. When it discovered Madara, it found the perfect pawn and, as such, secretly altered the Stone Tablet so that Madara would start taking the path Zetsu desired so as to ensure Kaguya's revival. Black Zetsu allowed Madara to believe he had created it so that it could take a direct role in guaranteeing the Infinite Tsukuyomi was performed correctly, but was also intent on hijacking the caster immediately afterwards in order to bring Kaguya back into the modern ninja world.

The Plan in Practice
After Madara's death, Zetsu and Obito — using Madara's name — approached Nagato's organisation, Akatsuki, with an offer of support. The leader at the time, Yahiko, refused his help, but Obito claims he later changed his mind. Upon Yahiko's death due to Hanzō, Nagato summoned the Demonic Statue and linked himself to it in a failed attempt to avenge Yahiko. In the aftermath, Nagato became the new leader of Akatsuki and he accepted Obito's assistance and guidance, though only he and Konan would ever know of Obito's contributions.

Obito told Nagato, a victim of the world's wars, that the world could be forced to stop fighting by creating a powerful weapon from the nine tailed beasts. Over the following decade, Nagato led Akatsuki to that end, first gathering manpower and resources before it began capturing the tailed beasts. In time, Akatsuki succeeds in sealing the first seven beasts into the Demonic Statue; by then both Zetsu and Obito (using the alias of "Tobi") join Akatsuki as members. But such successes came with several costs: through frequent conflict with Konoha-ninja, Akatsuki loses most of its members; Nagato has a change of heart and gives his life to revive the villagers of Konoha he killed during Pain's Assault, with Konan defecting from Akatsuki afterwards; because the tailed beasts were predominately possessed by the Five Great Shinobi Countries, capturing so many compelled a response to Akatsuki by the ninja world.

With Akatsuki no longer able to move in the shadows and with the Eye of the Moon Plan's completion so near, Obito began taking drastic measures. He sent Sasuke Uchiha to assault a Five Kage Summit held in the Land of Iron, hoping to weaken the convened Kage enough to force them to cooperate. When Sasuke failed and was nearly killed, Obito, still using Madara's name, stepped in. After getting Sasuke to safety, he shared details about the Eye of the Moon Plan and the peaceful world he hoped to create with those assembled, and asked that they hand over the two remaining tailed beasts, the Eight-Tails and Nine-Tails, in order to help him achieve this peace. He was refused, prompting him to declare the start of the Fourth Shinobi World War.

While the ninja world organised itself into the Allied Shinobi Forces and Obito prepared the White Zetsu Army, Black Zetsu became concerned that Madara's plans were not being followed. As such, it approached Kabuto Yakushi and revealed Madara's resting place to him so that he could use it to reincarnate Madara and blackmail Obito. Obito reluctantly accepted Kabuto's assistance with the war effort and went to Amegakure to retrieve Madara's Rinnegan from Nagato's body. He implanted the left Rinnegan into himself and hid the other, partly because he was unable to handle the power of two Rinnegan but predominately because he did not want Madara to have it.

The first day of the Fourth Shinobi World War was largely uneventful, though there were heavy casualties on both sides. Obito was able to acquire the Kohaku no Jōhei and Benihisago, within which were sealed the Gold and Silver Brothers, who had some of the Nine-Tails' chakra. On the second day, the Nine-Tails' jinchūriki, Naruto Uzumaki, entered the fight and almost all of Kabuto's reincarnated forces were defeated, forcing him to mobilise Madara. From the fact that he had not been revived correctly, Madara could tell Obito had deviated from the plan. When Obito learned of Madara's appearance on the battlefield he tried to capture Naruto and Killer B, the Eight-Tails' jinchūriki.

Obito was unable to capture either Naruto or B by the time that Kabuto was defeated. With his time running out, he placed the Kohaku no Jōhei and Benihisago within the Demonic Statue to, in combination with the other seven tailed beasts and a portion of Eight-Tails's chakra that Akatsuki acquired in a prior failed attempt to capture it, begin the Ten-Tails' rebirth. Madara, having cancelled his contract with the Impure World Reincarnation, tracked Obito down and chided him for failing to follow the Eye of the Moon Plan as he envisioned it. Madara tried to capture B and Naruto before the Ten-Tails is reborn, but he was unsuccessful. Obito and Madara took control of the Ten-Tails to try and destroy the remnants of the Allied Shinobi Forces, but enough survive to separate the Ten-Tails from their control.

In the confusion that followed, Obito wa able to leave the battlefield long enough to remove the Forbidden Individual Curse Tag from his body, releasing him from Madara's long-standing influence. When he returned, Madara attempts to force him to use his Rinnegan to restore Madara to life, but this failed when Obito defied Madara's control and instead seals the Ten-Tails into his body. Once he gained control of the beast's power, Obito, because he lacked dual Rinnegan, created a tree-form of the Ten-Tails, the flower of which would be used to cast the Infinite Tsukuyomi. Madara couldn't do anything to stop him due to the limitations of his reincarnated body, so he informed the Allied Shinobi Forces of what Obito was planning, indirectly spurring their counter-attack that removed the tailed beasts from Obito's body.

From his defeat and a conversation with both Naruto and Kakashi, Obito decided that all he's been doing up until now had been misguided and that he was only running away from his original dream of saving the world as a Hokage would. Remorseful, he prepared to restore to life everyone that died during the War. Black Zetsu intervenes at the last minute, forcing him to revive Madara instead, a move that leaves Obito greatly weakened and also near death's door. Madara, now properly alive again, was given the Rinnegan that Obito hid by a White Zetsu, which he used to seal all nine tailed beasts — including those sealed within B and Naruto — into the Demonic Statue. The Ten-Tails was reborn once more and Madara becomes its jinchūriki. Obito escapes to the other dimension so that Madara couldn't have the remaining Rinnegan. Despite the efforts of Sasuke Uchiha and Naruto — both empowered by the Sage of the Six Paths — Madara was able to follow Obito and take his Rinnegan back, awakening a Rinne Sharingan which he used to cast the Infinite Tsukuyomi.

The Infinite Tsukuyomi trapped the entire world in a dream; Sasuke shielded Naruto and the other original members of Team 7 from it and Obito, his body now controlled by Black Zetsu, was also unaffected. The reincarnated Hokage, being already dead, were also unaffected, but helpless to do anything. Madara then uses God: Nativity of a World of Trees to tether the world's entire population into the holy tree, drawing on their own chakra to fuel their imprisonment. His dream now a reality, Madara revels in his success, believing he has finally saved the people of the world from the horrors they enact on themselves. Naruto is greatly outraged, calling it nothing more than a lie. While Madara is preoccupied boasting to Team 7, Black Zetsu transfers from Obito's body to his, which it achieves by stabbing Madara in the chest via it using Obito's left hand. Black Zetsu tells a shocked Madara that Madara was not the saviour nor was Black Zetsu itself even Madara's will, stating that it was the will of Kaguya, which left Madara horrified and stunned at the fact that Black Zetsu had been manipulating and lying to Madara all along and the entire Eye of the Moon Plan was all a plot. It took control of Madara and used him to start absorbing the networked chakra, causing Madara great pain and ultimately converting his body into Princess Kaguya Ōtsutsuki, the original incarnation of the Ten-Tails and true progenitor of all chakra on Earth. Team 7 was left shocked as Black Zetsu's work finally comes to pass.

Aftermath
Having finally been brought back to the modern world, Kaguya planned to convert the human population that has been bound by the Infinite Tsukuyomi into her own personal army of White Zetsu. But, before she can do that, she attempted to eliminate Team 7 and Obito once and for all in order to remove the last opposition as well as to reclaim their chakra, which she believed rightfully belongs to her and no one else. After a prolonged fight, during which Obito was killed while defending Kakashi, Naruto and Sasuke successfully sealed her, removed the tailed beasts from her body, and in the process confined her to another dimension. In order to prevent Black Zetsu from reviving her again — which would ultimately trigger a new World War and cost many people their lives — Naruto made a point to personally entomb it alongside her and, as such, both Kaguya and Black Zetsu are permanently defeated.

With Kaguya and Black Zetsu finally defeated and imprisoned in the satellite, Naruto and Sasuke needed only to join hands to release the Infinite Tsukuyomi. Sasuke briefly resists this, believing the world's current immobility is an opportunity to eliminate all those individuals who threaten future peace such as the current Kage. Naruto ultimately persuaded him against this although the intense fight that follows subsequently destroyed the statues at the Valley of the End and cost both of them their respective dominant arms — Naruto his right and Sasuke his left — the two eventually ended the Infinite Tsukuyomi together with Sasuke also finally freed from his Curse of Hatred as he acknowledged that Naruto was the victor of their battle.

Trivia

 * Because of Naruto Uzumaki's frequent interference in the activities of Akatsuki, Obito blamed him for the plan's slow progress and the deviations he had to make.
 * Madara noted that, had Sasuke Uchiha been born sooner, he would have used Sasuke instead of Obito.
 * However, part of the reason Madara wanted to use Sasuke was because he also awakened a Straight Tomoe Mangekyō Sharingan, like Madara himself, which is implied to be because they are both Indra's reincarnates. It is also implied that Asura and Indra do not reincarnate until both current reincarnations have died as Asura did not reincarnate until after Madara's second death, which occurred decades after Hashirama's and both reincarnated shortly after Madara's second death. Thus, Sasuke would not likely have awakened a Straight Tomoe Mangekyō Sharingan if Madara used Sasuke as a pawn as Madara would still be alive and Indra would not have reincarnated into Sasuke.
 * Obito took a great interest in Sasuke's development and gaining his loyalty, even musing that he might synchronise Sasuke with the Demonic Statue. His reasons for this were never made clear.
 * Although the dream world of Infinite Tsukuyomi was planned to be full of peace and without chakra, anime adaptations of dream world include battles, deaths and wars. Despite this, the dreamer at the end would still become a "winner" in the dream.
 * Kisame Hoshigaki is the only Akatsuki member, aside from the masterminds Obito and Zetsu, to be aware of the Eye of the Moon Plan in the manga, having been introduced to it years before joining the organisation. However in the anime Nagato and Konan were both aware.