The Battle of the Five Armies was a five way battle between the five Armies: the Dwarves of Erebor, Elves of Mirkwood, Men of Dale (along with the Wizard Gandalf, the Hobbit Bilbo, the skin-changer Beorn and the Eagles of Manwë) versus the two Orc armies of Dol Guldur and Gundabad.
The battle was the first conflict in the War of the Ring.[1]
Prelude
Destruction of Erebor

Gandalf worried that Smaug would join Sauron.
Under Thror's rule, Erebor was expanded and became “the greatest kingdom in Middle Earth.” The nearby cities of Dale and Esgaroth prospered from its neighboring on Thror's realm, and all other Dwarf mansions were subjected to Thror as the heir to the Throne of Durin. However, the kingdom's partnerships began to deter, especially since Thror, hoarding a treasure that was beyond measure or any practical use, becoming enamored with the gold and refuse to give Thranduil the Gems of Lasgalen , not heating his old friends warnings that the wealth would bring him nothing but evil. This came to be when the hoard of gold attracted Smaug to the mountain, and resulted in the Sack of Erebor. While Smaug burned the nearby city of Dale, Thorin and his father heroically mustered the Dwarven army at the gate. He was no match for Smaug, however, who trampled his troops. Thorin was however able to rescue his grandfather, who foolishly took the Arkenstone with him to hide in the hoard, not knowing Smaug was already there.
Thorin led an exodus of whatever survivors he could find (not knowing more were trapped in the western guard-room), including his grandfather, and his father, who he heaved. During the exodus, Thorin called upon Thranduil (who came up Smaug's trail with an army) for help. Resentful and unwilling to risk the lives of his kin, the Elf refused. This deed, along with Thranduil's later refusal to house the refugees, would instill in Thorin a deep resentment for all Elves.
Sauron's plans
A Necromancer had settled in Dol Guldur. This sorcerer was in league with Azog (who set the price on Thorin's head) and with Smaug, and intended to stop the quest at all costs, sending Azog to hunt the company. It was his intention to use Smaug in the War of the Ring, as well as to use the Mountain to secure the Lands of Angmar and use them to harass the Northern kingdoms of Middle Earth.
Quest of Erebor

Gandalf urges Thorin to reclaim Erebor
In TA 2940, Gandalf intercepted a message promising payment for the head of Thorin Oakenshield. This aroused his suspicion of rising darkness and he intercepted the Dwarf exilarch and hatched the idea of the Quest of Erebor. The wizard claimed to Thorin that such darker minds could turn towards Erebor, possibly sway the dragon, who took it from Thorin's people, to their side and maybe use the location and riches of the Mountain itself to their advantage.
Unable to muster a great enough army without the support of all seven Dwarf kingdoms, Thorin assembled twelve of his compatriots to undergo a quest to retrieve the Arkenstone from the dragon. With it, he could command all seven armies against the dragon Smaug. Gandalf suggested Bilbo Baggins, a Hobbit, as a burglar to sneak past Smaug and take the stone and the Quest was under way.
Discovering the Necromancer

Sauron sent out his marshaled army to Erebor.
Gandalf later uncovered the Necromancer as a returned Sauron, but not before the Dark Lord sent out his secret army under Azog to secure the Mountain. From his cage, he watched as the armies of Azog advanced to the Mountain in order to reclaim it and revive Angmar once more.

An enraged Smaug flies to Lake-town to destroy it
Meanwhile, the company awoke Smaug and failed to slay him in the forges. The dragon, mistaking Bilbo for a man of Lake-town, went out to burn the city in revenge.
Destruction of Lake-town

Smaug confronted by Bard
As he burnt the city, Smaug was confronted by Bard, a descendant of Dale (itself conflagerated by the dragon) wielding the Black Arrow which would penetrate the dragon's weak-spot.

The survivors of Lake-town resettled in Dale after their home was destroyed
Smaug was slain, but the town of Lake-town was burnt and the survivors led by Bard had to resettle, choosing the ruins of Dale.
Siege of Erebor

Thranduil came with his own army to Dale to claim his own heirlooms
The company was reunited, but Thorin's grief and failure led him to spiral into madness. Blinded by greed and consumed by the dragon's curse, he refused to share his treasure with the Lake-town refugees to help alleviate their hardships. Instead, the Elvenking Thranduil came to their support, seeking to reclaim his own heirlooms: The White Gems of Lasgalen from Thorin's hoard.

The Elves and the Men of Lake-town demand remunerations from Thorin's hoard
Seeing that Thorin is beyond reason, the Elves and Men assembled an army to besiege the Dwarves inside Erebor until Thorin relinquishes some of his gold. The Dwarf, however, sent Roac the Raven to call upon Dain Ironfoot from the nearby Iron Hills. Thranduil was so bent on reclaiming the gems that he ignored Gandalf's warnings of the approaching of the Dol Guldur army. Unbeknowst to any of them, Azog's army was marching in secret through Rhun using tunnels dug by Wereworms, while Bolg mustered yet another army from Gundabad.

Dain, the Dwarf Lord of the Iron Hills, arrives to aid Thorin with his army
As the siege was underway, Dain arrived at the head of a Dwarven army, and the warring parties came to blows just as the Dol Guldur Army arrived.
The Battle
Skirmish at the Gates of Erebor

Thranduil relented and sent his Elven soldiers to join the fight against the Orcs
Azog's army engaged the Dwarves, but not before Thranduil relented to assist them. Azog then deployed Trolls, before Thranduil's volley killed some, allowing the Dwarven chariots to cut through the Orc lines. Ogres were then used to rush the chariots.
Thorin joins the battle

Thorin and the Company blast out of Erebor to join the battle
Dáin was pushed back to the side of the Mountain with heavy loses. Meanwhile, Thorin - who refused to join the fight - was confronted by Dwalin and eventually snapped out of his dragon sickness. He led the company out of the Mountain and rallied the Dwarven army to an assault which broke through Azog's lines.
Skirmish to Ravenhill

The Dwarves ride to Ravenhill to kill Azog
Thorin decided to lead an assault towards Azog's command tower in Ravenhill. Dwalin, Balin, Fíli and Kíli commandeered a Dwarven war chariot, following Thorin through the frozen channel of the River Running. Azog, intending the entire battle as a trap for Thorin, tried to stop his friends from reaching him, sending ogres, a Troll and Wargs after them. Bofur, astride a Troll, managed to help them against the Troll, but the Wargs forced Dwalin, Fili and Kili to take the mounts and leave Balin behind to fend off his foes while they went to Ravenhill.
Meanwhile, the ax in Bifur's head was struck to the head of one of his Orc foes. Bofur and Bombur helped throw the Orc off, dislodging the ax from Bifur's head, which instantly mended his speech problems.
Siege of Dale

The Orcs attack Dale
To force his adversaries to split forces, Azog had Dale attacked, forcing Bard to draw his forces into the city to defend the women and children. Gandalf and Bilbo went to fight with him, leaving the Elves and Dwarves to fight in the field.
Bard saved his children and ordered them to evacuate the women, children and wounded to the Great Hall. However, Hilda Bianca rallied the women to rejoin the battle. They took up weapons and decided that if they live with their men, then they'll die with them. Hilda discovered that Alfrid was hiding with them and called him a coward and a weasel before the women left to fight with their men.

Thranduil orders a retreat after seeing most of his fallen brothers
Thranduil led his forces into the city, but his mount was slain. He would later order a retreat after seeing most of his fallen brothers. However he has confronted by his son Legolas and by Tauriel.
Dale's siege ended with the men victorious.
Skirmish at Ravenhill

Legolas arrives after witnessing the Gundabad Army's approach
Thorin, Fili, Kili and Dwalin arrived at Ravenhill just as Tauriel and Legolas broke news to Gandalf of the approach of the Gundabad Army. Bilbo used the Ring to go and warn the Dwarves off of the trap, and Tauriel went with Legolas, after Thranduil was unmoved to go help them.

Bolg leads the Gundabad Berserkers into Ravenhill
Azog feigned a retreat, which drew Fili and Kili into the ruins of Ravenhill. When Bilbo arrived, Thorin realized the trap but before Dwalin could fetch back Fili and Kili, the former was caught by Azog and executed before his brother and uncle. Kili chased Azog and Thorin went after him. Dwalin also started to give chase before he went back, helping Bilbo fend off the Gundabad berserkers led by Bolg.

Legolas killed an Orc platoon, latched onto a Gundabad Bat
Legolas and Tauriel arrived, with Legolas latching unto the Bats of Dol Guldur brought from Gundabad, and dispatching a force going up Ravenhill to corner the Dwarves. He then settled on a sentry over the frozen waterfall.

Azog sends the Berserkers after Thorin
Thorin engaged Azog before the pale Orc retreated again, and had the Berserkers menace Thorin, pushing him to the edge of the frozen waterfall and breaking his sword. Legolas aided him with his bow.

Legolas sends a Troll to collide with a tower to fend off Bolg
Meanwhile, Tauriel was menaced by Bolg as she looked for Kili. The dwarf came to save her, but was killed by Bolg. Enraged, the elf lunged at the Orc and threw herself with him over the precipice to the slopes besides the waterfall. The Orc was not killed, however, and Legolas had to tip a tower across the gorge to get to Bolg and fend him off.

Thorin gets Orcrist back

Legolas duels Bolg, dispatching him with his knives
Overhead, Thorin threw one of the berserkers, which loosened Bolg's balance. To return the favor, Legolas threw Orcrist, which plunged into an Orc about to deliver a killing blow to Thorin. With his sword returned to him Legolas then dispatched Bolg with his knives.

The Eagles destroyed the Gundabad Orc army
Thorin engaged Azog with his returned sword, letting the Orc use his flail to crack the ice all about them. Distracted by the arrival of the Eagles and Beorn, who dispatched the approaching Gundabad Army, Azog didn't notice that he was now standing on a circle of ice. As Thorin stepped off, the ice tipped and the Orc slipped and fell under.

Azog is killed by Thorin
He burst from the ice however, not before stabbing Thorin in the foot, and standing over the Dwarf he drew his blade arm towards him. Thorin released Orcrist, allowing Azog to deal him a mortal wound, but giving himself the leverage to thrust back at Azog, killing him. Below, he witnessed the Dol Guldur army dispersed and routed before the Dwarf expired.
Aftermath

Thorin overseeing that the orc army bring completely wiped out.

Sauron fled into Mordor, abandoning his conquest of Erebor to bide time
With their commanders dead, their back-up forces gone and Allied reinforcements closing in, the Guldur-Gundabad forces were now trapped in the Erebor valley between three armies with no way out. The allied armies pressed home their advantage and commenced a terrible slaughter of Sauron's forces that lasted for countless hours while only a bare few managed to escape back into the tunnels from whence they came. They left behind tens of thousands of corpses and left the battered but victorious Allied forces in complete control of Erebor and Dale. Helpless to interfere, Sauron abandoned his conquest of Erebor and retreated into himself within Mordor to bide his time.

The Free Peoples' victory came at the price of Thorin Oakenshield's life
The Allied victory had however come with a terrible price; the Allied forces had suffered heavy losses including the loss of the Dwarven king Thorin Oakenshield.

Dàin Ironfoot succeeds Thorin as King under the Mountain.

A funeral was held in Thorin Oakenshield's honor
In the wake of the battle, a funeral was held for Thorin Oakenshield, Fíli and Kíli, with members of Thorin and Company, Beorn and Radagast in attendance while those in the city of Dale honored those who had fallen in Battle. The mountain was garrisoned by the Dwarves of the Iron Hills and portions of its wealth were distributed to various parties like the Men of the Lake, who set up permanent residence in Dale and elected Bard as the new Lord of Dale.

The Elves of Mirkwood stayed for a while to receive their share of the treasure.

Bilbo would leave the Company after his job was done, keeping the Ring as a trophy
The Elves of Mirkwood stayed just a short time to receive their share of the treasure before returning to their forest homeland. With Thorin and his immediate family members dead, Dain succeeded him as King under the Mountain. His job done, Bilbo Baggins parted ways with the Company and returned home to the Shire with Gandalf with his secret magic ring always close at hand.

Erebor was restored and became the greatest Dwarf kingdom of Middle-earth
Repopulated with Dwarvish colonists from each of the seven Dwarf kingdoms, Erebor was soon restored to its former glory and flourished once more, as did its neighbor-city Dale. In time, Erebor retook its place as the most powerful Dwarf kingdom in Middle-earth.
However the people of Dale, Erebor and Mirkwood banded together in the late Third Age during the War of the Ring
Items Involved
- Bilbo's Mithril Shirt: Used to protect the Hobbit; given to him by Thorin.
- Orcrist: Sword used to kill Azog the Defiler
- The Arkenstone: Used as a bargaining ship for Thorin,
- The Dwarves' "Whirly twirlies": Used to defect the Elves' arrows and used to kill the opposing sides.
Participants
Free People of Middle Earth
- Dwarves' Army
- Thorin and Company
- Thorin Oakenshield
- Bilbo Baggins
- Gandalf
- Balin
- Dwalin
- Óin
- Glóin
- Fíli
- Kíli
- Bifur
- Bofur
- Bombur
- Dori
- Nori
- Ori
- Dwarves of the Iron Hills
- Radagast's reinforcements
- Radagast
- Great Eagles
- Beorn
- Thorin and Company
- Elves of Mirkwood
- Men of Lake-town / Dale
- Bard
- Percy
- Hilda Bianca
- Alfrid Lickspittle (defected)
- Bain
- Sigrid
- Tilda
Sauron's Forces
- Sauron
- Dol Guldur Army
- Gundabad Army