The ending of Age of Extinction plays out in four moves: Galvatron escapes, Optimus hands the Autobots to the Yeagers, he takes a Seed into space, and he tells the Creators he is coming for them.
After the Decepticons are beaten, Galvatron retreats and swears he will come back. Optimus asks the Autobots to protect the Yeager family, then takes the Seed and flies into space, sending the Creators a message that he is coming for them.
Why does that matter? In my opinion, the finale turns the hero from a hunted refugee into the one doing the hunting. Early on, Optimus is badly hurt and hiding in Texas from Attinger and Lockdown, and the last scene reverses that, with Optimus choosing to take the fight to the beings who sent Lockdown. That is a bigger shift than it sounds, because in the three earlier Bay films the Autobots are mostly reacting to a Decepticon plan, whether it is the AllSpark in Transformers 2007, the Fallen in Transformers Revenge of the Fallen or the Ark and Sentinel Prime in Transformers Dark of the Moon.
The set pieces also earn the payoff. In Hong Kong, Optimus frees the Dinobots and wins their loyalty, so he leaves with an ally he did not have in act one. Then, in the last fight on Lockdown's ship, Optimus kills Attinger to save Cade, and Lockdown pins him down. It could be argued that the best beat is who finishes the job: Tessa and Shane free Optimus, and he kills Lockdown with Lockdown's own grenade. Handing the humans a role in the rescue keeps the Yeager family central, which is why Optimus asks the Autobots to protect them before he goes.
Galvatron is the loose thread. He is built from Megatron's remains, breaks free of Joshua Joyce's control and builds a Decepticon army, and his closing threat marks him as the Decepticon leader who survives. Paradoxically, the film's biggest antagonist, Lockdown, is the one it removes for good.
The ending sets up further stories involving the Creators and Galvatron. In Transformers The Last Knight, Optimus Prime has left Earth and meets Quintessa, while Mark Wahlberg's Cade Yeager is back, hiding outcast Transformers in a scrapyard. To see how the film sits among its neighbors, read Transformers movies ranked.