"The Road Goes Ever On" is a title that encompasses several walking songs that J. R. R. Tolkien wrote for his Middle-earth legendarium. Within the stories, the original song was composed by Bilbo Baggins and recorded in The Hobbit. Different versions of it also appear in The Lord of the Rings, along with some similar walking songs.
The original version of the song is recited by Bilbo in chapter 19 of The Hobbit, at the end of his journey back to the Shire. Coming to the top of a rise he sees his home in the distance, and stops and says the following:
There are three versions of "The Road Goes Ever On" in the novel The Lord of the Rings.
The first is in The Fellowship of the Ring, Book I, Chapter 1. The song is sung by Bilbo when he leaves the Shire. He has given up the One Ring, leaving it for Frodo to deal with, and is setting off to visit Rivendell, so that he may finish writing his book.
The second version appears in Book One, Chapter 3. It is identical except for changing the word "eager" to "weary" in the fifth line. It is spoken aloud, slowly, by Frodo, as he and his companions arrive at a familiar road - the - on their journey to leave the Shire.
The third version appears in The Return of the King, Book VI, Chapter 6. It is spoken by Bilbo in Rivendell after the hobbits have returned from their journey. Bilbo is now an old, sleepy hobbit, who murmurs the verse and then falls asleep.
Earlier, when leaving the Shire, Frodo tells the other hobbits Bilbo's thoughts on 'The Road': "He used often to say there was only one Road; that it was like a great river: its springs were at every doorstep, and every path was its tributary. 'It's a dangerous business, Frodo, going out of your door,' he used to say. 'You step onto the Road, and if you don't keep your feet, there is no knowing where you might be swept off to.'".