The situation of this battle was when the Alliance learned that Empire was constructing a second version of the Death Star. Knowing full well that this version would likely have corrected the original's design flaws that the Alliance exploited, it was decided that the station would have to be neutralized before it becomes operational.
With the sacrifice of the lives of many Bothan spies, the location of the base was found to be orbiting the forest moon of Endor. In addition, they learned that although the station was protected by a powerful deflector shield projected from a base on the moon, the station's weapons were not yet ready for service. Furthermore, they also learned that the Emperor himself would personally oversee the final completion of the station.
With a golden opportunity too good to miss, the Alliance planned a two pronged attack. A commando squad led by Han Solo, Princess Leia, Chewbacca and Luke Skywalker would land on the moon and disable the Imperial base's deflector shield projector which would allow a Rebel fleet to attack the station and destroy it.
Unknown to them, the Rebels were falling into a grand trap devised by The Emperor. Using simple disinformation, he hid the fact that the station's primary systems were already operational. With a large naval force hidden near the station and an elite legion of Imperial Stormtroopers standing by on the moon, he was ready to crush the Rebels once and for all.
The Rebels took the bait and the trap was sprung with the commandos captured at the moon's base and the Rebel fleet trapped by the Imperial naval force. To make things worse, the Death Star's superlaser proved to be an irresistible anti-ship weapon, destroying Rebel ships at will. General Lando Calrissian and Admiral Ackbar closed with the enemy fleet to buy time, but the situation was hopeless.
What turned the tide was that, unknown to the Emperor, the Rebel commandos had made an alliance with the indigenous Ewok tribe on the moon. The warriors attacked the Imperial Stormtroopers and soon defeated them with amazing ferocity and guile. The commandos then managed to gain access to the base and destroyed it which brought down the Death Star's deflector shield. A small squadron of fighters and the Millennium Falcon dove into the station's superstructure which to led them to the main reactor. They attacked it and caused it to start a massive explosion which destroyed the station.
Meanwhile, the Emperor, who was attempting to corrupt Luke Skywalker with the dark side of the Force, was killed by Darth Vader when he rebelled against him. With that death, it has been theorized that the subtle influence through the Force the Emperor exercised on his troops was removed and the Imperial Navy's fighting ability was greatly reduced, allowing the Rebel fleet to decimate and scatter them.