Ender's Game follows the story of Ender Wiggin, one of a group of remarkably intelligent children chosen by the government to attend Battle School. Here they undergo training in military tactics to prepare them to fight the buggers, Earth's greatest foe. Ender's journey and its shocking conclusion, ending with him unknowingly committing genocide against the buggers, is a complex story that raises questions about the meaning of reality, humanity, and accountability.
Humanity, having begun to explore the Universe and master interplanetary spaceflight, encounters an alien race dubbed the "buggers". The discovery of a bugger forward base in the asteroid Eros leads to war between the species and the destruction of a bugger colonizing force. The battle to recapture Eros results in the discovery of advanced alien technology, including gravity manipulation. Political conflicts on Earth between three ruling parties, the Hegemon, Polemarch, and Strategos, are put aside in the face of the threat from the buggers. Ostensibly in preparation for the expected third invasion, an International Fleet (I.F.) is established, with headquarters on Eros. Increasingly advanced starships are built and secretly launched to attack the buggers' home worlds. To develop commanders capable of defeating the much larger bugger forces, the I.F. creates a crash training program for children with the best strategic minds, the Battle School.
Protagonist Andrew "Ender" Wiggin is one of the school's trainees. He has a close bond with his sister Valentine; but fears his brother Peter, a highly intelligent sociopath. The I.F. remove Ender's monitoring device, seemingly ending his chances of Battle School, and he gets teased by a fellow student, Stilson. Ender beats up Stilson before the fight is broken up; unknown to Ender, the fight was fatal to Stilson. When explaining his actions to I.F. Colonel Hyrum Graff, Ender states his belief that, by showing superiority now, he has prevented future struggle. Graff, on hearing of this, offers Ender a place in the Battle School, situated in Earth's orbit, where Graff quickly isolates Ender from the other cadets.
The cadets participate in competitive war simulations in zero gravity, where Ender's innovations overwhelm his opponents. Graff promotes Ender to a new army composed of raw recruits, but Ender's success continues. He forms bonds of friendship, loyalty and trust with several of his current and former squad members. A jealous commander of another army, Bonzo Madrid, compels him to fight outside the simulation, and Ender unknowingly kills him.
On Earth, Peter Wiggin uses a global communication system to post political essays under the pseudonym "Locke", hoping to establish himself as a respected orator and thence as a powerful politician. Valentine, despite not trusting Peter, publishes alongside him as "Demosthenes". Their essays are soon taken seriously by the government. Though Graff is told their true identities, he recommends that it be kept a secret, because their writings are politically useful. Ender also takes a brief respite to build a boat, and hangout in a lake for some much needed time off.
Ender, now ten years old, is promoted to Command School on Eros, skipping several years of training. After some preliminary battles in the simulator, he is introduced to a former war hero, Mazer Rackham. From now on, while believing them to be simulations controlled by Mazer, Ender directs real human spacecraft against bugger fleets via an instantaneous communicator. As the skirmishes become harder, he is joined by some of his friends from the Battle School as sub-commanders. Despite this, Ender becomes depressed by the battles, his isolation, and by the way Mazer treats him.
When told that he is facing his final test, Ender finds his fleet far outnumbered by the buggers surrounding their queens' homeworld. Hoping to earn himself expulsion from the school for his ruthlessness, he sacrifices his entire fleet to launch a Molecular Detachment Device. The Device destroys the planet and the surrounding bugger fleet. Mazer informs Ender that he has been fighting real battles and not simulations, and that Ender has won the war. Ender becomes more depressed on learning this and of the deaths of Stilson and Bonzo.
When he recovers, he learns that, at the end of the bugger war, Earth's powers fought among themselves. He stays on Eros as his friends return home and colonists venture to other worlds, using Eros as a way station. Among the first colonists is Valentine, who apologizes that Ender can never return to Earth, where he would become dangerous as used by Peter and other politicians. Instead, Ender joins the colony program to populate one of the buggers' former worlds. There, he discovers the dormant egg of a bugger queen, who reveals that the buggers had initially assumed humans were a non-sentient race, for want of collective consciousness, but realized their mistake too late, and requests that Ender take the egg to a new planet to colonize.
Ender takes the egg and, with information from the Queen, writes The Hive Queen under the alias "Speaker for the Dead". Peter, now the leader of Earth and seventy-seven with a failing heart, requests Ender to write a book about him, which Ender titles Hegemon . The combined works create a new type of funeral, in which the Speaker for the Dead tells the whole and unapologetic story of the deceased, adopted by many on Earth and its colonies. In the end, Ender and Valentine board a series of starships and visit many worlds, looking for a safe place to establish the unborn Hive Queen.