(A previous version of this post appeared as an answer on Quora)
Centuries before any of the events depicted in The Lord of the Rings took place, the greatest kingdom of men, Numenor, waged war against Sauron and nearly defeated him. However, Sauron used his trickery to corrupt the Numenoreans and eventually caused their doom.
Once the threat of Sauron had become too great to be ignored Numenor assaulted Mordor under Ar-Pharazôn, the last and most powerful king of Numenor. The power of Numenor was so great that Sauron capitulated– gave himself up– and allowed himself to be taken captive.
He was brought back to Numenor as a prisoner, but in a short time was able to corrupt and manipulate the power-hungry king, becoming an advisor to the king, convincing him to defy the Ban of the Valar, and assault Valinor itself.
Ar-Pharazôn formed the greatest armada the world had ever seen, and sailed in force for Valinor, but the moment he set foot upon the shores of the Undying Lands, Manwe sought the intervention of Eru Illuvatar himself, who unmade the world, tearing Valinor away from the rest of Middle Earth, causing the great cataclysm which washed away Numenor, and drowned it under the sea. It also destroyed Sauron’s earthly body, such that from that day on, he was unable to assume a pleasant visage, and was henceforth only able to assume a physical form of menace and fear. His spirit returned to Mordor and restored its fortifications, and took up his ring once more.
The only surviving Numenoreans were those who remained faithful to the Ban and their Elven friends, and did not participate in the assault on Valonor. Led by Elendil the Tall and his two sons Isildur and Anárion, they established the Kingdoms of Arnor and Gondor in Middle Earth, setting the stage for the events of the Third Age, which ended with the War of the Ring.