After spending forty years tightening his grip over thousands of systems across an entire galaxy, Palpatine faces the threat of defeat from the increasingly powerful Rebel Alliance.
Desperate to keep a firm grip on any wavering planets, Palpatine orders the construction of a second Death Star, more powerful than the first. The Rebel Alliance plans to strike a shield generator on the forest moon of Endor, in order to weaken the defenses of the Death Star enough to attack the core. Though the strike team (led by Leia and Han) is ultimately successful, the Alliance is forced into a pitched battle above Endor.
During the battle, Luke Skywalker fights against Darth Vader (his father, the former Anakin Skywalker) on board the Death Star. Palpatine, hoping to repeat the downfall of Anakin as seen in Revenge of the Sith, tries to sway Luke with promises of ultimate power. When he refuses the give in, the Emperor moves to kill him. Darth Vader, when faced with the chance to save his son or let him die, opts to betray the Emperor and throw him deep into core of the Death Star.
Though the Imperial military would survive for another year (before their defeat at the Battle of Jakku), the apparatus of empire has been permanently damaged. The logical successor to the Emperor, his apprentice Darth Vader, was his killer, and soon dies from injuries regardless. Part of the trouble of concentrating supreme power into one individual (or one office) is the chaos that can result on the death of that person. The Empire post-Palpatine was the collapse of his bureaucratic system of government. With no clear strongman holding the disparate Empire together, it began to fracture, and fall apart.
Ultimately, the Emperor failed due to his own hubris. Upon hearing that Anakin Skywalker was the alleged Chosen One who would bring balance to the Force, Palpatine set about grooming the young and powerful Jedi for his eventual fall to the dark side, if only to spite the Jedi Order by corrupting the supposed Chosen One. Vader's eventual rejection of Palpatine, and the dark side, led directly to Palpatine's downfall, fulfilling his alleged prophecy.
All that said, the Rebel Alliance was still successful in their attack on the Death Star. For all of Palpatine's political genius, he was unable to detect the hints of Rebellion already stirring in the first days of Empire. The courageous few Senators dedicated to restoring the Republic, including Bail Organa, Mon Mothma, and Garm Bel Iblis, secretly funded and began the Rebel Alliance, all while publicly supporting Empire.
Palpatine was always convinced of his ultimate power, especially after the fall of the Republic. Though he had indeed amassed massive control over the galaxy, he was unable to fully control everything. The Rebellion grew in the shadows, remnants of the Jedi Order (like Obi-Wan Kenobi) survived in seclusion, and his death came at the hands of his most trusted subordinate. Empire cannot last in perpetuity, and the power of any individual can never be ultimate.