Loyalty in The Hobbit is often based on race. The goblins swear revenge against the dwarves because the dwarves have killed the Great Goblin. The elves and the dwarves have a long-standing mutual hatred because of some disagreement about payment for treasure many generations ago. Family also determines loyalty: Fili and Kili die beside Thorin because he's their uncle.
But this leaves us with the question: what generates loyalty between people who are not connected by blood and family ties? What kind of loyalty exists between Bilbo and the dwarves? Do they feel this loyalty equally? And how about Gandalf: what loyalty does he feel toward Bilbo and to the dwarves? How do these different characters prove their loyalty to one another?