The Return Journey
The Return Journey is 18th and penultimate chapter of The Hobbit.
When Bilbo awakens, he is still lying with a bad headache on the side of the mountain, but he is otherwise unharmed. From the camps below, he sees that his side has won the battle against the goblins and Wargs. A man comes searching for Bilbo but cannot find him until the hobbit remembers to take off his magic ring. Bilbo is carried back to the camp where Gandalf waits and is delighted to see the hobbit alive. However, there is sad business to attend to. Bilbo must say farewell to Thorin, who is mortally wounded. Thorin asks Bilbo's forgiveness for the harsh words spoken earlier.
Fíli and Kíli have also been killed, but the rest of the dwarves have survived. Gandalf describes the end of the battle for Bilbo: the eagles, watching the movements of the goblins, came just in time and turned the tide of battle. Yet things still might have gone badly were it not for the sudden appearance of Beorn in the shape of a bear, massive and enraged. This sent the rest of the goblins scattering, and now they are all either dead or in hiding.