Why The Elves Leave Middle-Earth In The Lord Of The Rings
Elves love leaving Middle-earth. They pine to hop in a boat and sail off into the blue. It's a trend we see in any rendition of "The Lord of the Rings." But why? Why do the more or less immortal Elves (it's complicated, but that's the general idea), feel the need to get outta Dodge? The short and sweet answer is pretty simple: They're tired and are looking for a spot where immortal beings can rest and heal.
This trend of Elves leaving Middle-earth is easy to spot. The "Fellowship of the Ring" book talks about the tradition of Elves leaving for the Grey Havens, "never to return." Everyone's aware of it, too. Sam Gamgee even notes, "They are sailing, sailing, sailing over the Sea, they are going into the West and leaving us." In the extended edition of the "Fellowship of the Ring" movie, we even see Elves heading to the Grey Havens. The book and movie versions of "The Return of the King" likewise end with Elrond (Hugo Weaving) and Galadriel (Cate Blanchett) taking a ship into the West. All of these events depict slow-moving, weary Elves. They aren't necessarily happy or sad, but they are worn out by the endless centuries of life in mortal lands.
If that sounds kinda random, it's important to understand the context. Middle-earth mastermind J.R.R. Tolkien describes Elves as the "Firstborn" children of Ilúvatar, i.e. the first group of sentient, humanoid beings that the Creator of Arda (Earth) introduces to his creation. They're followed by Men, who are called the Second Born. That's why we get all those "the time of Men has come" lines in any version of "Lord of the Rings." The Elves are tired and on their way out. Men are rising and ready to take their place.
Sooner or later, Elves needs a break from their existence in Middle-earth
Elves in Middle-earth are drawn inevitably toward the West. Not every Elf responds to that calling, but it's there, nonetheless. There are a few reasons this is the case by the time of "The Lord of the Rings." The "Go West, young Elf" urge starts way back at the beginning of Elvish existence. At that point, the Valar (angelic guardian figures who watch over Arda) try to bring the Elves en masse over from Middle-earth to their own home of Valinor on the continent of Aman (aka the Blessed Realm), located over the sea in the West. Many Elves initially go, but others linger behind, only slowly leaving their original homes to head toward the promised bliss that awaits.
Over the millennia, this urge to eventually make the journey West is compounded by the fact that the Elves begin to "fade." While J.R.R. Tolkien is vague about what this looks like, there is enough information the author gives us to establish an official Elvish life cycle in "The Lord of the Rings." This reveals that, unlike humans, whose spirits leave Middle-earth when they die, Elves are tied body, spirit, and soul to the creation itself. If they don't die from violence or grief, the physical part of those bodies can fade away from wear and tear given enough time, leaving just their spirits behind. This is especially true in a mortal land like Middle-earth, whereas the West is an immortal realm maintained by immortal god-like guardians. Again, Tolkien's descriptions are hard to piece together here, but in essence, you could say that most Elves seek out the West sooner or later as a way to find immortal rest for their tired and weary existence.
Some Elves are exiled to Middle-earth and seek to return to the West as well
By the time of "The Lord of the Rings," Elves have been on the front lines of creation for millennia. They are tired out by the endless wars with Sauron and his original master, Morgoth. For many of them, these villains are actually the reason they left the West in the first place. In "The Silmarillion," J.R.R. Tolkien describes how, during the First Age of Middle-earth history, some of the Elves get to the West only for Morgoth to stir up trouble back in Middle-earth. A group of the Elves (Galadriel among them) willingly goes back into exile in Middle-earth. At the end of that age, Morgoth is defeated, and in a letter to his publisher, Tolkien summarized:
The Exiled Elves were, if not commanded, at least sternly counselled to return into the West, and there be at peace.
Some Elves take this advice. Others stubbornly refuse, like Galadriel, who lingers in Middle-earth and stays busy in its politics and wars throughout the Second and Third Ages that follow. By the end of the Third Age, when "The Lord of the Rings" takes place, many of these hold-overs are tired of their endless labors and feeling the pressure of having resisted the "stern counsel" to return home. So, once Sauron falls, they finally see the writing on the wall, hand the baton over to all the humans, and head home.
Not everyone goes right away, though. Elrond and Galadriel leave sooner. Legolas eventually goes (with Gimli still by his side). Others, like Celeborn, follow as well, but much later. And while the details are slim here, many Elves never do leave. They linger, fading into spirits that will remain in Middle-earth indefinitely.