I couldn't quite make out what the lyrics were to the song they sang in Bilbo's house. What song was that, and why did they sing it?
It was an old dwarvish song, presumably originating from a time not long after Smaug took over the Lonely Mountain. It describes a desire to return to reclaim their home under the mountain, primarily for the earthly treasure located there (the song describes in great detail the nature of the various treasures). Later verses in the song also briefly narrate the story of Smaug coming and destroying the town of Dale, forcing the dwarves to flee.
Here are the lyrics from the song as recorded in the book:
As to your question concerning why they sing it, I've always likened it to ancient Israelite songs of returning to Zion or American slavery spirituals -- such singing provides inspiration, motivation, and community, keeping a focus across generations on a cultural goal that holds deep, deep significance for a group of people. The song was likely ingrained in the dwarves' cultural heritage, perhaps being sung in their homes, their churches, their schools, etc. Because of this, when the dwarves are at Bilbo's house, ready to finally start this journey that all their people had been singing about for so long, they couldn't hold back, and that song seemed the best choice for communicating their excitement and sense of fulfillment.
They cut out a lot of the lyrics of the original for the movie. The abridged one in the movie is,
Whereas the full lyrics are,