Star Trek Beyond/Summary/Act Three

As Krall departs for Starbase Yorktown, Kirk, McCoy, Spock, and Jaylah rescue the crew before repairing the Franklin and also setting a course for the starbase. Spock and McCoy beam aboard an attacking drone ship and discover a way to disrupt the drones' cohesion, allowing the Franklin and the starbase to destroy much of the drone fleet using discordant noise on a very high frequency (VHF), provided courtesy of Jaylah's collection of "classical" late 20th century music.
After a brief battle between the swarm and Yorktown's defenses, Krall still manages to board the starbase despite the Battle of Yorktown, which eventually culminates in the Franklin intercepting his ships in a maneuver near the starbase's central control complex.
As they look for him, Uhura learns from the Franklins video logs that Krall's original name was Balthazar Edison and that he was born Human. Before his sudden disappearance, Edison had been the captain of the Franklin. He had been declared missing in action by Starfleet, and had ended up crashing onto Altamid, which was a former mining colony of an alien species known as the Ancient Ones, who had left drone equipment and other technology behind. Edison, and at least two of his crewmates, had used the remains of this technology to prolong their lives, and to build new military vessels. However, the use of the life-extension technology had also rendered the former members of the Franklin unrecognizable as Humans because they acquired some of the biological attributes of the other species they lured for their consumption.
Once Krall/Edison is on board the Franklin, he steals a command division and reverts to a mostly Human appearance after draining the life force from several more Enterprise crewmembers, healing the injuries he suffered when his ship was crushed.
Krall/Edison prepares to deploy the bioweapon, leading to a chase through the base. Kirk confronts Krall/Edison in the life support hub, and they fight in anti-gravity and weightless conditions in the life support section of Yorktown. Krall/Edison expounds his theory that Humanity needs to be in a state of conflict in order to progress, and that the Federation has stifled this process by bringing about peace in large areas of the galaxy. The fight ends with both Krall/Edison and the Abronath bioweapon being ejected into space, where the Abronath devours him.
Kirk is rescued from suffering the same fate by Spock and McCoy in their hijacked drone. Kirk tells Spock he doesn't know what he would do without him, causing him to contemplate his decision to leave Starfleet.
Commodore Paris closes the unsolved cases of the fate of Captain Edison and the crew of the USS Franklin. She commends Kirk for his actions and informs him that his promotion to the admiralty is assured. However, Kirk respectfully declines the offer, his experience having rejuvenated his spirit to be a Starfleet officer, stating that "admirals don't fly". Remaining a starship captain, Kirk allows McCoy to lead him to a gathering where McCoy has planned a surprise birthday party for his friend. At a loss for words, Kirk instead raises a toast to the late starship Enterprise and to their fallen comrades. Spock allows himself a look at some of Ambassador Spock's personal effects and finds a photograph of him and his prime reality comrades on the bridge of their Enterprise. 
Reminding himself of his earlier discussion with Dr. McCoy, Spock elects to live as his alternate self did and remains serving in Starfleet. Kirk offers his condolences on Ambassador Spock's passing to his friend, which Spock accepts and begins to renew his relationship with Uhura. A despondent Jaylah, also present at the gathering, has consumed a large number of alcoholic beverages, which she had been told would "take her edge off", but is clearly not having much of an effect. Hoping to boost her spirits, Scott presents Jaylah with an acceptance letter into Starfleet Academy, courtesy of a few strings pulled by Kirk, who also warns her that Starfleet has many rules but not to follow all of them. 
As Kirk and Spock look out of a massive window, they view the construction of a new starship. Considering the perils that had befallen the Enterprise and her crew since they were first assembled five years earlier, McCoy questions whether or not they really should go back out into space. As the starship finishes construction, its primary hull proudly displays her name and registry: . Kirk, Spock, Scott, McCoy, Sulu, Chekov, and Uhura can be heard taking turns paraphrasing Zefram Cochrane:
:"Space: The final frontier. These are the voyages of the starship Enterprise. Its continuing mission: To explore strange new worlds. To seek out new life and new civilizations. To boldly go where no one has gone before."