(Spoilers all over the place here, folks!)
Allegiant opens with our hero, Beatrice "Tris" Prior, in a prison inside a prison. See, she's in an actual jail cell for going all traitor in the last book and revealing information that has changed the city forever. We're so ready to bust out of this giant fenced-in city, Shawshank-style.
After Tris lies her way out of jail, she's approached by a group called the Allegiant, whose goal, conveniently, is to get out of the city. This plan is looking better and better because Evelyn, Tobias's mom, is enacting stringent rules to keep the citizens of the city under her control.
Pretty much everyone is a traitor these days, so Tobias helps bust Tris's brother, Caleb, out of jail, and soon they're all hopping on the Allegiant express out of town. Assisted by Johanna Reyes, who, along with Cara, is a leader of the Allegiant, they take a train to some trucks and head outside the fence. Unfortunately, Tori is shot on the way out by a Dauntless patrol. Good thing she got to avenge her dead brother in last book, huh?
The outside world looks pretty much the same as the inside world, just with more advertising and more ruined buildings. The group meets a patrol consisting of newcomer Zoe and Tobias's presumed dead Dauntless trainer Amar. They take everyone to the Bureau of Genetic Welfare, which is housed inside what used to be Chicago's O'Hare airport. Along the way, they're told that their city is called Chicago (making them officially the last people to know this), and Tris is given an old photo of her mother and some other dude.
The other dude turns out to be David, the head of the Bureau, who, like Tris's mom, is a lot older now. (Unlike Tris's mom, he is not dead. Amar may have faked his own death, but Tris's mom is assuredly dead as a doornail.) David explains that Chicago is a great social experiment meant to correct genetic damage caused by government experiments intended to rid people of unwanted characteristics like violence, greed, "cowardice, dishonesty, [and] low intelligence" (15.15). They didn't feel like tackling body odor while they were at it?
People whose genes have healed are known as "Divergent." People whose genes have not healed are given the less glamorous moniker of "genetically damaged." After being tested by Matthew the lab tech, Tobias finds out he's not Divergent and gets put into the "genetically damaged" camp. Womp womp.
Matthew's assistant, Nita, takes Tobias into the fringes to see how people really live around here: they pretty much get into violent fights in the alleyways between the shacks they live in. Nita wants to put a stop to this whole genetically damaged nonsense, being a GD herself.
Meanwhile, Tris goes through her mother's old journal, which was given to her by Zoe, whose sole purpose in life seems to be giving Tris things her mother left behind. The journal entries reveal that Tris's mom volunteered to go into the city to try and stop all the violence that was happening there. Nice try, Ma.
Tobias eventually brings Tris to meet Nita, who says she wants to steal some memory serum to keep David and the Bureau from using it to reset the memories of everyone in Chicago. Tris doesn't believe her, and she refuses to help Tobias. But Tobias decides to go against Tris and with Nita. This turns out to be a bad decision, because it turns out that Nita wants to kill everyone. They set off a bomb, which injures Uriah, and take David hostage.
Tris is determined not to let Nita get her hands on the death serum (having learned from Matthew that that's what her plan is), so she ends up grabbing David and using him as a human shield so that she can escape before he can tell Nita the code for the death serum. (Got that?) Nita and Tobias are arrested as traitors. Tobias goes free, on account of him being genetically damaged, but Nita doesn't, even though she's genetically damaged, too. Who knows how this justice system works?
Anyway, Tobias ends up feeling guilty about putting Uriah in a coma. When Tris finds out that the Bureau plans to just wipe the memories of everyone in Chicago, Tobias volunteers to go into the city and inoculate certain friends and family members, like Uriah's and Christina's families. He also plans to apologize to Uriah's family. ("Sorry I put your son in a coma, but the explosion was really cool!")
Meanwhile, Tris decides it would be a good idea to let out the memory serum on everyone in the Bureau first. The problem: whoever enters the room housing the memory serum will inhale death serum and die. Caleb is nominated because everyone hates him, anyway. Tris and Tobias split up and get all gushy about how much they love each other. Then Tobias heads into the city.
Tobias manages to convince Evelyn to put an end to her power hunger and give up control of the city. She forms an alliance with the Allegiant, and they agree to let everyone live on their own terms and be happy. Aww. Why couldn't they have done this three books ago and spared everyone all the trouble?
Back at the Bureau, an emergency lockdown goes into effect, forcing Tris to start her plan sooner than expected. She decides to sacrifice herself instead of Caleb, because he's doing it to absolve himself of guilt (wrong reason) and she's killing herself in the name of love (right reason).
Tris miraculously survives the death serum and opposite-of-miraculously dies when David shoots her as she unleashes the memory serum.
So, the main character is dead, and the memory of everyone in the Bureau is wiped. Tobias returns to find Tris dead. He cries and mourns a lot and almost erases his own memory, but Christina convinces him not to.
Two and a half years later, Tobias proves that fear is not a factor for him when he zip-lines from the Hancock Building in Chicago, scattering Tris's ashes all the way down. He still misses her, but he's determined to look for the good in life with his friends.