Please be aware this page contains spoilers. In particular, the plot of The Hobbit is discussed in the "Synopsis" section.
The book may be read as a bildungsroman in which Bilbo matures from an initially insular, superficial, and rather useless person to one who is versatile, brave, self-sufficient, and relied-upon by others when they are in need of assistance. Compare this to Joseph Campbell and his writings on myth and in particular, the journey of the epic hero[?].
Tolkien, a professor, later recalled that the book's writing began from a single senseless sentence ("In a hole in the ground there lived a hobbit") scrawled on an exam paper he was grading (compare Lewis Carroll's composition of The Hunting of the Snark). When he began, he did not intend to connect the story with the much more profound mythology he was working on (see The Silmarillion). We can witness the fact that Tolkien intended it to be "only" a non-related fairy tale in his choice of names: Cockney names for the goblins, and Norse names for the dwarves rather than the Elvish names of the heroes of The Silmarillion.
However as Tolkien continued, he began to feel that the events of The Hobbit really could belong to the same universe as The Silmarillion. The appearance of Elrond and the mentioning of Gondolin (as well as other nameless hints) are proof of that. However Tolkien also left a lot of "loose ends" and gaps that he filled in by his much later Lord of the Rings.
Bilbo Baggins, a hobbit, is smoking on his veranda one day when Gandalf the Wizard visits him. Bilbo dismisses Gandalf, who scratches a Burglar-for-hire mark on Bilbo's front door. Thirteen Dwarves (Thorin, Oin[?], Gloin, Dwalin[?], Balin, Bifur[?], Kili[?], Fili[?], Bofur[?], Dori[?], Bombur[?], Nori, and Ori[?]) show up and begin excitedly discussing their planned treasure hunt while the hapless Bilbo provides the obligatory hospitality. After cleaning up their mess, the map is produced and Gandalf arranges for Bilbo to get the burglary job -- as well as to break the unlucky number 13. The company's quest: kill the dragon that captured the Lonely Mountain (Erebor) from the Dwarves' forefathers, and retake the Mountain itself, dividing the riches inside.
The next morning, after oversleeping and nearly missing the start of the journey, Bilbo goes off with the Dwarves. They are nearly eaten by three trolls, but Gandalf tricks the trolls into staying up all night whereupon they are turned into stone by the first light of dawn. (The stone trolls appear later in The Lord of the Rings.) In the troll's cave they find some swords. Bilbo acquires Sting, which glows blue in the presence of goblins (Orcs).
The party travels to Rivendell where they enjoy the hospitality of the Elves, then proceed eastwards towards the Misty Mountains. There they are ambushed by goblins (another name for Orcs), and carried under the mountain. They run away, and during the escape Bilbo loses the Dwarves. Alone in the dark after running away from the goblins, Bilbo finds a ring on the floor of a cave passage and puts it into his pocket.
Continuing down, he finds himself at the shore of an underground lake. Gollum quietly paddles up in his boat, and the two enact the Riddle Game, under the condition that if Bilbo wins, Gollum will show him the way out, but if he loses, Gollum will eat Bilbo! After several riddles, which each manages to answer, Bilbo, unable to think of any more riddles, asks, "What have I got in my pocket?" Gollum demands three guesses, but has to give up. Bilbo demands his reward, but Gollum refuses and leaves. Bilbo leaves, and Gollum chases him. Bilbo trips, but Gollum runs right over him. Bilbo realizes the ring makes him invisible. He manages to escape past Gollum, who had gone to guard the only exit, and finds his way to the surface where he rejoins the Dwarves.
Descending from the Misty Mountains, they survive an encounter with Wargs (wild wolf creatures) by climbing trees. Eagles rescue them. Then they meet Beorn, a man who can transform into a bear. They depart, having rested for several days. Gandalf leaves them soon, they cross the great forest where they foolishly try to beg food from Wood-elves[?] and get lost. Gandalf had warned them not to leave the path, but they saw the fire and heard the singing. They are captured by giant spiders, but Bilbo rescues the Dwarves by killing 50 spiders with Sting. Elves then capture the Dwarves and imprison them, but Bilbo manages to sneak into the Elvenking's palace unnoticed using the ring; he then helps the captured Dwarves to escape in barrels floating down a river.
After staying for a short period of time at Laketown[?], the party of treasure-seekers proceeds to the Lonely Mountain, and with the help of starlight are able to find the door. Bilbo is sent down to encounter Smaug. The dragon, realizing the Company received help from the people of Laketown sets to destroy it; he is shot down by an arrow while attacking and the party take possession of the treasure.
Thereupon follows a war over the disposition of the treasure, as people of Laketown demand a share of the treasures in exchange for the help they had given and the damage that was caused to them by the dragon; they're joined by the Elves, who also demand a share. The Dwarves on their behalf summon their kin, and war seems always inevitable. However then, Bilbo uses the invisible ring to steal the Arkenstone and help broker a truce.
At the same moment, the three armies near the Lonely Mountain (Elves, Men and Dwarves) are attacked by Goblins and Wargs from the Misty Mountains. A bitter battle ensues (named the Battle of Five Armies). After a bitter fight and suffering heavy losses, Elves, Men and Dwarves prevail. Bilbo refuses most of the riches, realising he has no way to bring them back home; he nevertheless take enough with him to make himself a wealthy hobbit and live happily thereafter, unaware of the dangerous nature of his ring.
Bilbo's retirement lasts another half dozen decades, until his eleventy-first birthday, when he leaves Hobbiton for good. After being urged on by Gandalf, he bequeaths the magic ring to his heir Frodo -- who turns thirty-three the same day. The complete tale is contained in The Lord of the Rings.
In the first edition, Gollum willingly bets his magic ring on the outcome of the riddle game. Tolkien later revised this passage to reflect the concept of the One Ring and its powerful hold on Gollum, developed while writing The Lord of the Rings. Tolkien weaves this version into the story line of The Lord of the Rings as a "lie" that Bilbo made up (probably because of the One Ring's influence on him), which he confesses to Gloin the dwarf at the Council of Elrond.