Weiss, you dumbass! SPOILER ALERT - Plot details for NieR follow.
Nier is the playable character in the prologue and later the primary antagonist of Nier RepliCant and its remake, who is the leader of the Shades. He first appears at the end of the first half of the game and serves as the antagonist for the remainder of the game. He is known as the Shadowlord throughout the main game.
The Lost Verses and the Red Sky depicted Nier and Yonah fleeing from a Red Eye attack. He was separated from his sister in the panicking crowd of pedestrians and was eventually led to her whereabouts at Kainé's home. Despite witnessing the danger of their berserk states, Nier vouched for Emil and Kainé. His faithful cries for their humanity simultaneously restored their sanity.
Nier and Yonah took part in the Gestalt experiment prior to the prologue, but the former grew suspicious of the project and the potential dangers of the Gestalt process. This led him to take Yonah with him and escape the facility, leading to the events of the prologue.
"Stay away from my sister!"
The Shadowlord is actually the original Nier, who was the player character in the beginning of the game. In the year 2053, 50 years after the incident where the Dragon and the Giant appeared in Tokyo, Nier and Yonah (as real humans) were trapped in Shinjuku when its lockdown commenced. Nier sought help for Yonah's growing disease from a charity organization's center that supposedly handed out food and medicine for the survivors. Instead he, along with twelve other people, received a clone of the Grimoire Noir. The charity was actually a human experimentation site designed to find the "Original Gestalt", who can keep their own consciousness even after going through the Gestalt process.
When Nier saw the fellow survivors turn into crazed, relapsed Gestalts, he escaped with Yonah and sought refuge in a supermarket. The relapsed Gestalts found them, however, and Nier was forced to turn to the black book so he could fight them off. Yonah presumably touched the grimoire to help Nier, but this caused her to start to relapse and fall into a deep sleep. Nier was soon deemed the Original Gestalt that the organization needed to continue with Project Gestalt.
The Lost Verses and the Red Sky adds that he was originally kept in solitary confinement and constant surveillance by the organization. For five years, he allowed any experiment to be done on him so long as they could cure Yonah. Unfortunately, science had reached its limits for any cure, so a compromise was struck. After humanity returned their souls in their Replicant bodies, which was optimistically projected to take a thousand years, they promised they would then have the means to find a cure for Yonah. It is on this promise alone that Nier had agreed to do the organization's bidding and wait. Both parties were aware that if they had failed to keep their word, Nier would rebel.
Nier's soul was separated from his body as part of Project Gestalt, and this bodiless Shade is later named Shadowlord. Just like the Replicant Nier (the character played throughout most of the game), Shadowlord's ultimate goal is to save his sister and humanity (the Shades). All the sentient Shades are linked to the Shadowlord, and his death would cause them to relapse.
In the end, with no word on the project's success centuries after the projected date, Gestalt Nier lost faith in the promise and gave into loneliness. He kidnapped Replicant Yonah to force Gestalt Yonah into her body. This set to motion the Replicant Nier's quest for vengeance.
"Yonah... I cannot live... in a world without you..."
― Nier as the Shadowlord
The Shadowlord makes his first in-game appearance when Nier's village is assaulted by Shades. Using Jack of Hearts as a diversion, the Shadowlord infiltrated the village library to kidnap the Replicant Yonah hiding inside it.
Nier fought his way into the library, seemingly defeating the giant Shade, but was ambushed by the Shadowlord. The Gestalt impaled Nier through his shoulder, critically wounding him. Despite their best efforts, Nier and Grimoire Weiss were held back by Grimoire Noir, whose defense allowed his master to be victorious in his goal. Fleeing with the Replicant Yonah in hand, the heroes were left to face the seemingly immortal Jack of Hearts inside the Library.
After he returned to his castle to give his Yonah her body, Shadowlord guarded her. He was also aware that his Replicant would come to his domain for Yonah. His plan was to wait for his Replicant to come to him, claim Nier's body as his own, and finally be reunited with his Yonah when she woke up.
The hitch was being bested by Nier and Grimoire Weiss in combat. Wounded by his Replicant's attacks and powerless to stop her, he was devastated when his long-awaited reunion with Yonah ended with her committing suicide. Giving up any will to live, he allowed a clueless Nier to kill him soon after. His soul reunites with his Yonah in the afterlife, depending on the ending.
It is revealed in NieR:Automata that as a result of Nier disappearing from existence, the human race eventually went extinct, due to the Gestalts relapsing and the Replicants dying from either the Black Scrawl or natural causes. This event led to the creation of YoRHa, the operation that would perpetuate the lie that humanity was still alive and on the moon.
It is also stated that the machines' psychological development was a result of the remnants of Project Gestalt's data being uploaded to the network, including the data of the original Gestalt: Nier.