Sage Vyaasa, who classified the Vedas into four parts, is the author of the epic Mahabaratham. Lord Ganesha put the slokas in writing as sage Vyaasar narrated it. Vyaasar first taught his son, sage Sukar and several other other disciples, thus ensuring the epic tale was not lost to the future generations.
It is believed that sage Narada told the epic to the Devas, Sage Sugar taught Mahabaratham to the Gandharvas, Rakshasas and Yakshaas and Vaisambaayanar, a chief disciple of sage Vyaasa told the Bhaaratham to mankind. He narrated the epic sotry during a yagna performed by king Janamejayan, son of king Pareekshit. Pareekshit was the son of Abhimanyu and Uttarai, the grandson of Arjuna and Subathra.
This Bharatham narrated by Vaisambhaayanar was later told by Sudar to several rishis led by rishi Sounagar in the Naimisaaranyam forest.
Sage Vyaasa is siad to have rendered a total of 60 lakhs slokas. The epic, as is available to us now consists of 18 sections (parvas) with 98 sub sections (sub parvas), 2,382 chapters with 96,635 verses.
The 18 sections have been classified under four classifications - Aadhya Panchakam (5 sections), Yudhdha Panchakam (5 sections), Shaanthi thryam (3 sections), Andhya Panchakam (5 sections). Each of the sections such as the Aadi parvam have several sub sections within.