The Hobbit | The Lord of the Rings | J. R. R. Tolkien | Silmarillion | Elf | Wolf | Goblin | Dwarf | Human | Eagle | Bat | Beorn | Bilbo Baggins | Gandalf
In chapter 17 of The Hobbit, by J. R. R. Tolkien, a great battle takes place between armies of men, dwarves, elves, orcs, wolves, bats and eagles. It is called the battle of five armies because the primary participants on the ground were of five different races. A little context is in order, however (without summarizing the book in its entirety):
Thorin and party meet the goblins in chapter five. By chapter six, the party has escaped essentially unharmed, whilst the goblins have suffered many losses including their great goblin. Later in chapter six, the wargs have joined the goblins, and the party gets stuck in trees with fire below. Then the eagles rescue them and carry them to their eyrie. Chapter seven starts with the eagles leaving the party near Beorn's haunts.
After meeting, staying with and leaving Beorn, the company meets the elves on the far side of Mirkwood forest at the end of chapter eight. The dwarves, with Bilbo's help, escape the elves' prison in barrels by floating downriver to the Long Lake. In the midst of this lake is the town of men, and the party comes to this town at the beginning of chapter ten.
(After the dragon was slain by Bard in chapter fourteen...)
All of Middle Earth has now heard of the death of Smaug, mainly due to the spreading of news by the birds. Now the elves join the men in rebuilding their town and come to the mountain in hopes of cashing in on the absence of the dragon. But Thorin and company have also been busy, setting ravens to call Thorin's relatives to the mountain. Unbeknownst to all of these (until the very last minute), the goblins and wolves also march toward The Lonely Mountain through underground passages.
And now, in the midst of chapter 17, the elves and men are about to fight the dwarves. Just as the first arrows fly, Gandalf steps into the middle of the fray and commands (with some touches of lightning) that everyone "Halt!". He then explains to all that the goblins and wolves are very near, and the three armies drop their prior quarrel. Then ensues the Battle of Five Armies. Bats and eagles also fly in overhead. In this battle, Thorin is mortally wounded, and his near kin Fili and Kili die attempting to guard him. Indeed, the whole battle might have been lost (on the part of the elves, men, dwarves and eagles) had it not been for Beorn, who came into the fray as an enormous bear. It was Beorn who took up Thorin while he was yet alive, bearing him to a place of safety, then came back to battle and destroyed wherever he went. Thus, though originally far outnumbered, the elves, men, dwarves, eagles and Beorn were able to win this battle.