After the events in The Scorch Trials, Thomas is locked up in solitary confinement for three weeks. He is released and Assistant Director Janson admits to him and the other Gladers (including ones from Group B) that there is a cure for the Flare and that they were not lying to them about it. Everybody (including Teresa) began to jump around. Janson then announces that some people, including Newt, are not immune to the Flare. He also warns them that many people in the outside world hate them because of their unnatural resistance to the Flare, and that if they escape they will probably be in more danger.
Janson then gives the Gladers a chance to get their memories back. Everyone, except for Minho, Newt and Thomas, agrees to get their memories back. As a result, while everyone gets their memories back, Minho, Newt and Thomas are kept in confinement under the watch of guards and more cameras. Even though Minho, Newt, and Thomas say no to it, they are eventually forced to get their memories back the next day, as Janson (or Rat Man) thinks that they would be of no help to finding the cure without their memories. Luckily, Brenda, who manages to convince him to let her help sedate Thomas, helps them escape before they are given their memories back.
They discover the test subjects who received their memories were able to escape too, thinking that the other Gladers had abandoned them (it is revealed later on that the other Gladers had instead thought that they had already escaped before them). Before leaving, Newt give Thomas a note, telling him that he can't read until the time is right. Shortly after that, Thomas, Minho, Newt, and Brenda escape onto a Berg, a massive airship. Jorge reveals himself to be a skilled pilot, and that Teresa, Aris, Frypan, and the other test subjects have escaped on one of the 3 Bergs.
Some guards break into the hangar, wielding Launchers (which fire electrical stun grenades), and pistols. Jorge manages to get all of them into the air, but both Thomas and Brenda are struck by Launcher grenades. They fly to Denver, where Teresa and the others have escaped to. They pretend to be people looking for a job when really they are there to see Hans, a former WICKED neurologist who has escaped, in order to get him to help them remove the Swipe in Minho and Thomas's brains. The Swipe allows WICKED to control them, therefore they have to remove them as soon as possible.
Upon arriving at Denver, Newt is left behind in the Berg as he is the only one who is not immune to the Flare. While they are on their trip, a mysterious man hands them a note which reveals an address where they meet up with Gally, a previous Glader who tried to kill Thomas, and also a member of the Right Arm, an underground organization dedicated to destroying WICKED.
After which, at Hans', WICKED finds a way to control Thomas with the implant still in his brain, in an effort to kill Hans and prevent him from removing the implant in Thomas's brain. As Thomas is held down by the others, Hans manages to perform an operation on Thomas, removing the implant in his brain that allows him to telepathically talk with Teresa and Aris and that lets WICKED monitor where he is. When the operation is completed, Brenda, Jorge, Minho, and Thomas go into a coffee shop to eat. There, Brenda points out a man who is infected with the Flare but taking the Bliss. When the infected man is discovered in the coffee shop, Thomas decides to stay and watch what is happening, accidentally revealing himself to the 'guards' that he is immune to the Flare and that he already knew that the man was infected but still did not do anything.
When he is about to get in the guard's car, a flying law enforcement vehicle shoots the man down, and on the screen is Janson, who tells Thomas to come back to WICKED for the Phrase 3 of the Trials. Thomas who needs to escape from him, lied and tells Janson that he would consider, even though he intends to never go back to WICKED and help them.
When the group arrive back at their berg, they discover that Newt is missing. They find a note from Newt which states that some people found him and took him to a Crank sanctuary, where Cranks live before they go crazy. Brenda knows of the place, which is called the Crank Palace, and all of them fly there immediately, in an attempt to bring Newt back. They manage to bribe the guards with money from WICKED (Jorge has access to this from a stolen card that once belonged to the Rat Man) and find Newt in a bowling alley. Along the way, they see that the living conditions of the Crank Palace are not good, though they see a Crank couple that looks somewhat normal. Thomas attempts to persuade Newt to come back but is forced to leave at gunpoint. They also find out that the Cranks at the palace plan to attack Denver. The entire visit Newt claims that Thomas failed him, though Thomas is confused.
A riot breaks out and a massive Crank escape occurs, with Thomas, Brenda, Jorge, and the others narrowly getting away in the berg. After the berg lands back at the airport, Thomas reads the letter that Newt gave him while they were escaping from the WICKED complex.
The letter states, "Kill me. If you've ever been my friend, kill me." Thomas realizes that Newt forced them to leave because Thomas had not followed the letter's directions, but this only happened because Thomas did not realize that before they went to the Crank Palace was the 'right' time to read the letter.
Once they open the Berg's bay door, the group is captured by 4 bounty hunters who are wielding Launchers and pistols. Bags are put over their faces and they are driven to an unknown complex. There, the group overpower the guards, and at gunpoint, the bounty hunters tell that they work for the Right Arm. There, they also meet Teresa and the other subjects who were also captured by the same bounty hunters. Minho demands that they take Thomas and Brenda to their headquarters, where they want to speak to the leader of the Right Arm. A bounty hunter named Lawrence drives them there in a van. Along the way, they have problems because they bump into a large crowd of Cranks, who are desperate for food. The Cranks attempt to get Lawrence, Brenda and Thomas out of the van by constantly pounding on it and attempting to smash the windows. Finally, however, they get away after Thomas shoots a few Cranks with a pistol .
At the Right Arm's headquarters, they meet Vince, the leader of the Right Arm, and a friend of Gally. The Right Arm and Thomas plan an infiltration plan to get the Right Arm into WICKED's base. They plan to plant a device in WICKED's headquarters, which are just outside Denver, which will disable their soldiers' weapons (pistols and Launchers), allowing the Right Arm, trained heavily in CQC with traditional weapons (knives, swords, etc.) to gain the upper hand. Thomas volunteers to plant the device because WICKED wants him back for Phase 3 of the Trials, and he could take advantage of that to enter WICKED facilities.
They agree on the plan and Thomas gets into a vehicle with Lawrence and the pilot (who would pilot the Berg), with Lawrence driving to the hangar, where their Berg awaits them. At one point while driving, Thomas sees Newt. Lawrence is forced at gunpoint to stop the van as to let Thomas get out and shoot Newt in the head, fulfilling his friend's last wish. They continue on until they reach the base. They get into the Berg where Thomas rests for a couple of hours. Thomas is dropped off a few miles away from the base at the planned location. He hikes to it and is greeted by Janson. Thomas plants the device immediately when he made an excuse to use the bathroom and has to wait for 1 hour for the device to finish working.
During this time, Janson tells Thomas that he is the Final Candidate, and that WICKED needs to perform a fatal brain operation on him to finish the blueprint of the brain, ultimately leading to a vaccine and/or a cure for the Flare. Thomas tries to put off the operation for as long as possible but it is too late. While trying to buy time for himself, he discovers that Janson has contracted the Flare and that he is planning to do anything to complete the brain blueprint. Thomas is eventually saved by Chancellor Paige, head of WICKED, who calls off the operation in favor of a different plan involving the Immunes to restart civilization after the Flare disappears. Chancellor Paige also gives Thomas a map to escape from the Maze to the place she wants him to go to via a Flat Trans. Thomas discovers that the couple hundred Immunes that WICKED has gathered are being hidden inside the Maze. On the way, however, he runs into Janson and a colleague of his. Already desperate as time is ticking, Thomas manages to escape them by throwing a knife and stabbing Janson's colleague in the neck, but with Janson on his tail, he runs off to find Vince.
Vince informs Thomas that the explosives have been planted in WICKED already and that if Thomas planned to try and go inside of WICKED once more just to save the Immunes, he would consider that as Thomas going against the Right Arm. Thomas still decides to go back to save the Immunes and complete the mission Chancellor Paige issued him. He asks Gally to come and help him, and while Vince informs Galley the same thing (if they were to go back to WICKED it would be considered as betrayal), Gally agrees to help Thomas. The two soon find the others (Teresa, Brenda, Minho and Jorge) and they all set off to save the Immunes.
They make it all the way to the Maze and find about four hundred to five hundred Immunes of all ages in the Glade. They all split into groups, in an attempt to have a mix of ages and strengths in each group. Before they can escape the Maze, however, it starts to collapse from the explosives that the Right Arm had planted. On the way they encounter more Grievers. Thomas manages to deactivate them by pulling on the handles at the back of their bodies, as Teresa told him to do. At one point, Teresa sacrificed herself to the last Griever in an attempt to let the others escape, but Thomas manages to save her.
They make it to the maintenance room with the Flat Trans that Paige mapped out; where they meet the Flare-infected Janson and 6 other WICKED security guards. The Gladers manage to overpower the guards and Thomas strangles Janson to death. When the maintenance room starts to collapse, a large piece of stone from the ceiling is about to crush Thomas but Teresa tackles him and gets crushed instead. Thomas knows that Teresa cannot survive the massive internal organ damage and is forced to go through the Flat Trans without her, before the whole WICKED complex is destroyed.
The Immunes are transported to "Paradise". Brenda tells Thomas that "Paradise" would be a good new start, then Brenda leans in and kisses Thomas. Very few of the original Gladers survive, such as Frypan, Minho, and Gally. Minho is seen taking responsibility and giving groups of people jobs in order to get the place up and running. With only Immunes in this paradise, the Flare would cease to exist.
In the final WICKED memorandum by Chancellor Paige, she reveals that WICKED released the Flare from a quarantine zone as an attempt to control world population after the sun flare catastrophe and that they have tried to correct their evil doings by trying to create a cure and a vaccine. Seeing that the results were not pointed to let the human species survive, the highest people of WICKED agreed that the only way to mend the catastrophe was to let the Immunes start the world over again. Paige then writes that the organization had only one goal: preserve the human race. In leaving the Immues to rebuild civilization, she reinforces the idea that had been attempted to have been planted in all of the subjects of the experiments: WICKED is good.
[to be added]