The day after Bilbo gives him the Arkenstone, Bard, the elves, and an old, cloaked man march to the Gate of the Lonely Mountain to greet Thorin. They ask him if he will bargain with them for some of the treasure. When Thorin refuses, Bard produces the Arkenstone, and insists that while he is not a thief, he’ll trade it back to the dwarves in return for what his people rightfully deserve: food and shelter. Thorin is furious, and demands to know how Bard got the Arkenstone – Bilbo timidly admits that he was the one who gave it away. Thorin seizes Bilbo, insults him, and wishes aloud that Gandalf were with him; at this moment, Gandalf reveals himself to be the old, cloaked man, and demands that Thorin release Bilbo.
Bilbo, in admitting that he was the one who gave up the Arkenstone, faces the consequences of his actions rather than simply trying to manipulate events. Put another way, Bilbo (with some nervousness) trusts that the good intentions of his actions will be understood. Gandalf’s sudden appearance—perfectly timed for the moment when Bilbo needs him most—suggests that he’s more involved in the dwarves’ quest than he seems, and in fact, might have been secretly watching them all along.
Bilbo tries to justify himself to Thorin. He explains that Thorin told him he could choose any part of the treasure for himself as his share, and so he chose the Arkenstone. Thorin doesn’t disagree with Bilbo, but he calls Bilbo a traitor and dismisses him from the Lonely Mountain, saying that he hopes he’ll never see Bilbo again. Bilbo departs from the mountain and joins Gandalf, the men, and the elves. While Bilbo is saying goodbye to the other dwarves, Thorin threatens to shoot him.
While Thorin recognizes that Bilbo’s interpretation of Thorin’s words is accurate, Thorin nonetheless refuses to accept the spirit behind Bilbo’s actions: to try to avoid a war fueled by greed. Rather than see Bilbo as trying to save the dwarves from themselves, Thorin’s greed for his treasure is such that he can only see giving it away as treachery and as a basis to sever his friendship with Bilbo. Note that Thorin and the dwarves, now, are isolated and alone in the same way that evil characters like Smaug and Gollum were portrayed as being.
Thorin tells Bard that in exchange for the Arkenstone he will trade him one-fourteenth of the treasure, which he will take from Bilbo’s share. Meanwhile, Thorin thinks to himself that he might be able to regain the Arkenstone with Dain’s help, and thus avoid having to surrender any of the treasure to Bard. Bard tells Thorin that he has until noon of the next day to deliver him the treasure.
Despite Thorin’s loyalty to his word, he’s so greedy that he always thinks about ways to keep his wealth, even if it involves war. This is ultimately what distinguishes him from Bard: although both leaders regard treasure as extremely important, Bard does so because he sees it as a way to promote peace and happiness in his people, whereas Thorin sees treasure as an end in itself.
Shortly after Thorin agrees to surrender some of his treasure, Dain arrives, leading an army of strong, tough dwarves carrying many supplies. Bard refuses to let him through to the Lonely Mountain and give supplies to the other dwarves. Dain plans to wait out Bard, while in the meantime many other dwarves related to Thorin arrive from around Middle-Earth, having been alerted by ravens and thrushes that they are needed. Bard sends messengers to the Gates in the hope of negotiating, but the dwarves shoot arrows at these messengers instead of giving up their treasure. Dain and his army advance toward the men, and Bard is ready to open fire on them, starting a huge battle. The Elvenking urges Bard to wait a little longer, in the event that a last-minute event might prevent war.
War seems inevitable: the dwarves’ armies are ready to fight, and Bard’s last-minute efforts for a compromise are met with arrows. Yet the Elvenking remains hopeful, telling his soldiers, and the men, to wait, in the event that peace could be reached. This moment partially justifies Bilbo’s feeling that the elves are the best of the three peoples at the mountain—they seem the least willing to resort to violence, the most wise and patient. Here the Elvenking’s words pause the march to war, at least for a while.
Just as a battle is about to break out between the elves and men and the dwarves, the skies darken, and Gandalf comes, bringing news that a new goblin leader, Bolg, and his army of goblins and wargs is about to arrive – the skies are black because an army of bats accompanies the goblins. The narrator explains that the goblins, incensed by the death of the Great Goblin, have been pursuing the dwarves in search of revenge. With Gandalf’s encouragement, the men and elves ally with the dwarves and fight against the goblins and wargs: this is eventually called The Battle of the Five Armies. In order to defeat the goblins, the elves, men, and dwarves lure them into the wide valley between two arms of the Lonely Mountain, and then surround them. In this manner, a long, bloody battle begins.
Gandalf is a powerful warrior, but he’s an equally brilliant organizer and negotiator. Here, he organizes three opposing forces, men, dwarves, and elves, together in the interest of peace. This loose confederacy, united against a common enemy but still somewhat at odds with itself, might reflect Tolkien’s experiences during World War I, when the “Triple Entente” of France, England, and Russia, three historical enemies, allied together to defeat Germany.
Bilbo is unimportant during the Battle of the Five Armies; he wears his invisibility ring the whole time. Nevertheless, for a long time afterwards, it is this portion of his journey that he’s most fond of relating to others. Bilbo, standing close to Gandalf, sees the men, dwarves, and elves fight together to defeat the goblins. The elves are the first to attack the goblins, and at first, it seems as if the goblins will be defeated. Then, the men, dwarves, and elves realize that they have only defeated the first wave of enemies—many more goblins are coming.
Here, at the climax of The Hobbit, Bilbo doesn’t play a crucial role at all—on the contrary, he hides away. It’s as if Tolkien has been preparing Bilbo for the role of a hero throughout the story, and then doesn’t fulfill. But Bilbo’s distaste for fighting isn’t purely cowardly—he has legitimate moral reasons for hesitating to fight. He doesn’t value treasure, as the peoples around him do, and indeed, his role in the quest has been over for some time. Further, the novel has emphasized different types of heroism, and Bilbo’s heroism is not the sort to turn the tide of a pitched battle.
Goblins quickly overwhelm the mountain. But just as they begin to climb the walls of the Main Gate, Thorin and the other twelve dwarves burst out and bravely fight back. Many die throughout the battle; the elves, in particular, suffer great losses, since they didn’t bring enough troops to begin with. Bilbo stands with the elves, since he would prefer to ally with them. He thinks that battle is a dirty business, and that all the stories that say that battle is glorious are lies. The battle goes on for many hours, without a clear victor. The goblins seem like they are about to take the Gate when Bilbo sees the Eagles arriving from the skies, but a stone hits him in the head, and he loses consciousness.
There’s nothing glorious about the Battle of the Five Armies—Tolkien doesn’t throw in any jokes or funny asides, as he did in early scenes that involved violence. With the exception of leaders like Bard, who seem genuinely committed to helping others, most of the different peoples participating in battle are greedy, short-sighted, and selfish (not unlike the Western countries who fought in World War I)—by this logic, battle is a dirty business indeed, and Bilbo isn’t wrong to avoid it. Tolkien might be remembering his own experiences in the trenches during the Battle of the Somme, when he was almost killed.