As told in The Silmarillion, Elves and Men are the two Children of Ilúvatar. The Elves are the 'Firstborn', and woke by the waters of Cuiviénen during the age of the Trees, when Valinor was bathed in the light of the two trees, while Middle-earth lay in twilight, lit only by the stars. When they awoke, their first sight was of the stars, and they have therefore always loved the starlight. The Valar wished to bring the elves to Valinor, and many of the three kindreds of the Eldar - Vanyar, Noldor and Teleri - made the journey there and dwelt in the city of Tirion or on the shores of Aman. Men are the 'Followers', and did not wake until the first rising of the Sun, after the destruction of the Trees and the flight of the Noldor from Valinor. They woke in the land of Hildórien, and spread over all of Middle-earth, though many were drawn westward towards the rising sun.
The elves were immortal, save that they could be slain in battle, or waste away from grief. They are bound to the world, and love it deeply. Their spirits are gathered in the halls of Mandos in Valinor, and it is possible for them to be reborn into the world. However, to men Ilúvatar gave a restlessness of spirit, a desire to seek beyond the world, and an ability to shape and change their destinies. They are therefore subject to death, which is itself called the 'gift of Ilúvatar', and with death their spirits pass beyond the confines of the world. Yet Melkor cast his shadow over men's understanding, so that they have come to fear death. However, it is said that at the world's end, men will join in the second music of the Ainur, but the fate of the elves is not told.
Not long after they awoke in the world, Men encountered the Dark Elves - those who had never gone to Valinor - and learned much from them. But it was not until Finrod Felagund, elven king of Nargothrond, encountered the kindred of Bëor in Ossiriand, that one of the Eldar - the elven kindred who had beheld the light of Valinor - befriended Mankind. The kindred of Bëor thus became the first of the three kindreds of the Edain, called the Elf-friends. The second were the Haladin, or People of Haleth, and the third, the House of Hador. Many heroes arose among these three peoples, and it is from the two marriages between Eldar and Edain that the Halfelven are descended.
Men found most welcome among the Noldor, who invited the Edain to dwell among them in the West of Beleriand. Not all accepted this invitation, and among those who remained in East Beleriand there were mutterings against the Eldar. The dark lord Morgoth sought to encourage this mistrust, and to drive a wedge between elves and men. Yet the alliance between Eldar and Edain endured the assults of Morgath, and lasted through the Second Age after Morgoth was defeated. However, when Sauron arose as a new dark lord, he touched the hearts of many men, and though the hosts of elves and men joined together in the Last Alliance to overthrow Sauron, after this time the two kindreds became estranged. The elves began to withdraw from involvement in the concerns of men, and it was only in Rivendell that the memory and the lore of the bond between elves and men was preserved.