The son of Tuor and Idril daughter of Turgon, Eärendil was raised as a child in Gondolin. When Eärendil was seven years old, he escaped the sack of Gondolin with his parents, living afterwards in Arvernien by the mouth of Sirion. Eärendil later became the leader of the people who lived there, and married Elwing, daughter of Dior the son of Beren and Lúthien. They had two sons, Elrond and Elros.
With the aid of Círdan the Shipwright, Eärendil built a ship, Vingilótë (or Vingilot), which is Quenya for foam-flower. He sailed this often around the seas west of Middle-earth, leaving his wife behind in Arvernien. At this time Elwing had in her possession the Silmaril that Beren had wrested from Morgoth. News of this came to the sons of Fëanor that were still living, and they attacked the people living in Arvernien, and slew most of them. But Elwing, rather than be captured, threw herself with the Silmaril into the sea. The Silmaril was not lost, however. According to The Silmarillion:
For Ulmo bore up Elwing out of the waves, and he gave her the likeness of a great white bird, and upon her breast there shone as a star the Silmaril, as she flew over the water to seek Eärendil her beloved. On a time of night Eärendil at the helm of his ship saw her come towards him, as a white cloud exceeding swift beneath the moon, as a star over the sea moving in strange courses, a pale flame on wings of storm. And it is sung that she fell from the air upon the timbers of Vingilot, in a swoon, nigh unto death for the urgency of her speed, and Eärendil took her to his bosom; but in the morning with marvelling eyes he beheld his wife in her own form beside him with her hair upon his face, and she slept.
Hearing of the tragedy that had befallen in Arvernien, Eärendil then sought after Valinor, and he and Elwing found their way there at last. Eärendil thus became the first of all mortals to set foot in Valinor. Eärendil then went before the Valar, and asked them for aid for Men and Elves in Middle-earth, to fight against Morgoth; and the Valar accepted his plea.
Because Eärendil had undertaken this errand on behalf of Men and Elves, and not for his own sake, Manwë forbore to deal out the punishment of death that was due; and because both Eärendil and Elwing were descended from a union of Elves and Men, Manwë granted to them and their sons the gift to choose to which race they would be joined (a gift which was further passed to the children of Elrond, who became known as the Half-elven). Elwing and Eärendil chose to be joined to the Elves; and the Valar took Vingilotë and with Eärendil upon it set it to sail through the sky, with the Silmaril bound upon his brow. The Silmarilion says this:
Now when first Vingilot was set to sail in the seas of heaven, it rose unlooked for, glittering and bright; and the people of Middle-earth beheld it from afar and wondered, and they took it for a sign, and called it Gil-Estel, the Star of High Hope.
The Valar, having listened to Eärendil's plea, went with a mighty host to Middle-earth, and overthrew Morgoth, and bound him.
Concerning the Name
Eärendil is a Quenya name, meaning 'Lover of the Sea'. However, Tolkien created the name based on Old English literature. It is derived from the Old English star-name éarendel, which is usually considered to refer to Venus, the morning star. The name occurs several times in extant manuscripts, but most notably in the poem Crist, in the lines éala éarendel engla beorhtast / ofer middangeard monnum sended, which can be translated roughly as, 'Hail Earendel, brightest of angels, sent over Middle-earth to men.' (In Norse mythology, "Middle-earth" is the world that humans live in; Tolkien borrowed this term for his own purposes.)
This is notable because the first line is paralleled by Frodo's exclamation in Cirith Ungol, Aiya Eärendil Elenion Ancalima! which is Quenya, and means 'Hail Eärendil, brightest of stars.' Frodo's exclamation was in reference to the 'Star-glass' he carried, which contained the light of Eärendil's star, the Silmaril.