The Silmarillion account
As it is told in The Silmarillion, by the end of the five centuries after the rising of the sun, Morgoth had defeated all who opposed him and become mighty and uncontested in Middle-earth. The mariner Eärendil, by the light of the Silmaril on his brow, searches and comes to Valinor, on behalf of the two kindreds (that of Elves and Men), asking the Valar to pardon and aid the enthralled Elves and Men of Middle-earth.
The Valar are moved by Eärendil's plea and prepare a great armament. The armies of the Vanyar and the remaining Noldor are sent from Aman to Middle-earth in a mighty host. At the behest of Elwing, their kinswoman, the Teleri carry the host on their ships, but they remain on their ships for they would not land. The Host of Valinor marches through Beleriand and meets the forces of Morgoth.
The Host of the Valar completely defeats the Orc armies of Melkor and destroys most of the Balrogs. While the Three Houses of Men, the Edain, fought for the Valar, many other Easterling Men fought for Morgoth and are either destroyed or flee to the far eastern parts of Middle-earth. The Host of the Valar marches north to Angband in pursuit of the remnants of the hosts of Morgoth. There Melkor releases his last and greatest force, the fleet of winged dragons, that had never been seen before, and they drive the Host of the Valar back. Then Eärendil comes with his ship Vingilótë, along with the Eagles of Thorondor, Lord of Eagles, and there they contest with the dragons in the air, slaying most of them. Eärendil engages the mightiest of dragons, Ancalagon the Black, for twenty-four hours, until at last he throws down Ancalagon from the sky, whose fall breaks the towers of Thangorodrim, the volcanic triple-peak mountain range that Melkor had raised above the gate of Angband. Morgoth is captured and he is bound again with the chain Angainor. His iron crown is beaten into a collar, his feet are "hewn from under him", and the two Silmarils are taken by the Maia Eönwë, the herald of Manwë. Finally, the Valar imprison him in the Void behind the Door of Night.
The wreckage of the war is immense. The River Sirion is destroyed. Much of the north of the land west of the Ered Luin is laid waste and sinks into the sea. The surviving Elves of Beleriand are bidden by Eönwë to return with him to the lands of Aman. Most of them do so, but others refuse the summons and instead journey eastward where they become lords of the remaining Noldor and Sindar, as well as others in the east such as the Silvan Elves. Among these were Gil-galad, Galadriel and Celeborn, Círdan, Elrond, Celebrimbor, and Thranduil. It should be noted that Círdan was following his mission set by the Valar in the First Age and therefore the summons likely did not apply to him.
After Morgoth's defeat, those men of the Edain who fought for the host of the Valar are granted the island land of Andor. Following Elros as King, they found the realm of Númenor. Morgoth's chief servant, Sauron, surrenders to Eönwë and is summoned to Valinor to receive judgement by the Valar. However, he is unwilling to face the Valar and flees to the east, as do some Dragons, Trolls, Balrogs and Orcs to trouble the Men, Elves and Dwarves through later ages.