The Roads Go Ever Ever On and the Road Goes Ever On and On is one of the best known of Tolkien’s poems. It was written between 1928 and 1948.
In Collected Poems it is #115. There it is speculated if the poem was based on one of several or if simply the theme was popular during the time period and common in poems and stories he would have read when he was young.

In Chapter 19 of the Hobbit, Bilbo upon seeing the Hill recites the poem, Roads go ever ever on, and Gandalf says, “My dear Bilbo! Something is the matter with you! You are not the hobbit that you were.”
In Chapter 3 of Book One of the Lord of the Rings, Sam, Pippin and Frodo are making their way to Crickhollow. “The road goes on for ever, but I can’t without a rest. It is high time for lunch.”
As Pippin sits down, Frodo looks out over the road and begins reciting the poem.
Pippin asks Frodo if it is one of Bilbo’s rhyming and Frodo isn’t sure if it was or not.
He recalls Bilbo saying, “It’s a dangerous business, Frodo, going out of your door. You step into the Road, and if you don’t keep your feet, there is no knowing where you might be swept off to.”

Artwork by: https://www.kuliszu.art/
In Chapter 6 of Book Six of the Lord of the Rings, Bilbo asks Frodo about the Ring and Frodo tells him he got rid of it. “What a pity! I should have liked to see it again.” He then goes on to begin to recite the poem before falling asleep.
The poem then is at the conclusion of the Hobbit and the beginning of the adventure in the Lord of the Rings and at the end.
Twice the poem is presented when witnessing the comfort of home and as addressed in a previous post sanctuary, which it is.
It also emphasizes change. Gandalf declares it to Bilbo in the Hobbit; Sam, Pippin and Frodo recite and discuss it as they begin their plight to leave the Shire; and again change is noted when Bilbo asks what happened to the Ring.
The Road, then, encompasses the adventure that begins upon it, the change it brings about, and the sanctuary one finds at the end of it.
