I took this out of the
Encyclopedia of Arda, hope this helps:
The ending of The Lord of the Rings has caused a certain amount of confusion among readers and viewers alike. This is perhaps not completely surprising, because it's necessary to know a little of the history of Middle-earth to understand why Frodo steps onto the White Ship at the Grey Havens.
From the most ancient times, the Valar (the Powers of the World) had dwelt in the land of Valinor, in Aman beyond the Great Sea, called the Blessed Realm and the Undying Lands. Their lands of peace and plenty had once been part of the World, and they welcomed the first Elves there to enjoy their lives of immortal bliss. Through a chain of tragic events, though, some of the Elves rebelled against the Valar, and exiled themselves from Valinor by returning to Middle-earth. Among them were Galadriel and the ancestors of Elrond.
These exiled Elves fought a centuries-long war against the first Dark Lord, Sauron's master Morgoth, in which they were aided by certain houses of Men. After Morgoth's defeat, these Men were rewarded with a new home - the island of Númenor in the middle of the Sea, where they built the greatest and most powerful nation of Men to have ever existed.
Ultimately they became too great even for Sauron to meet in battle, so instead he used the power of his Ring to seduce the already corrupt King of Númenor, and persuaded him to launch an invasion of Aman itself. As Sauron had foreseen, the result of this foolish act was utter disaster for the Númenóreans, and their entire island home was destroyed. A few survivors, led by Elendil, escaped the destruction and returned to Middle-earth.
At the same time, Aman was 'taken away' from the world, so that it became impossible for mortals to sail there except by the special grace of the Valar. However, it was granted to the Elves to continue to travel there, so that an Elvish ship travelling into the West would eventually come to the green lands of the Blessed Realm. It's to Aman, then, that the Elves are travelling in The Lord of the Rings, never to return to Middle-earth. This explains Arwen's burden of regret and the difficulty of her choice - by refusing to sail from the Grey Havens, she gives up an eternity in paradise to stay with Aragorn.
The choice of those Elves who sailed on the White Ship was a simple one, then - indeed, for Galadriel, this would be a homecoming: she had been born in Valinor, and been among those exiled millennia before. It would be a homecoming for Gandalf, too, because the Wizards were actually Maiar, immortal beings of the same kind as the Valar themselves.
For Frodo, the two years he spent in the Shire after the Downfall of Barad-dûr were filled with suffering and regret. The wounds he had received on the journey continued to pain him, but worse than this was the memory of the Ring, which during the Quest had taken hold of his mind. "'It is gone for ever,' he said, 'and now all is dark and empty.'" (The Return of the King VI 9). Across the Sea, he could be freed from all this, so his decision to sail into the West is not perhaps so surprising. Being mortal, neither Frodo nor Bilbo could enjoy the unending lives of the other peoples of the Undying Lands, but they could live out their days free of the burden of the Ring.