In Command School Ender meets Mazer Rackham, the man who defeated the Buggers (Aliens) eighty years ago and who will prepare Ender to do the same thing.
My name is Mazer Rackham.
Mazer Rackham shows Ender the Simulation Room where Ender will fight in a simulation of an actual battle against the Buggers. Ender also sees his friends Petra, Dink, Alai, Bean and his toon leaders from his army who will help him.
Ender then has one last battle in the simulation but all the generals and commanders of the fleet were wacthing him. He wins it and all of them begin to celebrate. They then explain to him he was fighting the actual buggers the whole time and that they won.
You did it Ender.
Ender goes to sleep and wakes up learning that there was a war on Earth just been negotiated. He sees his friends again and is asked by Valentine if he wants to go to the Buggers world to colonize it. Ender agrees.
Okay I will go
Come with me to the Buggers world.
A few months later in the Buggers world Ender finds part of his old fantasy game that leads him to the cocoon of the Bugger Queen. He communicates with her and learns that they wanted peace all along. Ender then wrights a book about the Queen in which he calls himself (the speaker of the dead).
The whole war was usless!
Ender and Valentine leave to find a place for the cocoon and to write about people's lives.