Allow me to assume you are referring to classical Greek mythology (although the division could be applied to other mythologies.) Besides Zeus and Hera (the Uber-gods, the father and mother of the gods), the known universe was first split into three geographic parts—the sea, ruled by Poseidon, the land, ruled by Persephone, and the sky, ruled by Aether. But that is an oversimple division: one could also name Athena, Aphrodite, and Ares, as a trio dividing human impulses—Wisdom, Love, and War, respectively. In fact, your assumption—that there were three main gods, can itself be questioned. The actual answer has to do with the natural and automatic division of anything into three parts: Positive, negative, and “beyond good and evil” (as Rumi puts it). Anything can be divided into these three parts. Consider heaven, hell, and earth.
The three main gods are most commonly known as 'The Big Three'. These 3 gods are all sons of Kronus/Cronus and Rhea. 'The Big Three' are Zeus, Poseidon and Hades, even though Hades is not an olympian. When the war of the Gods and the Titans ended, each of these three divided up the land; Zeus took the sky and heavens, Poseidon took the seas and Hades took the underworld, not the earth but the world under the earth. They were called 'The Big Three' because their children with motals, called demigods were the most powerful heroes of them all, for example-Zeus had Perseus (Who killed medusa) and Heracles/Hercules (Who went through the labours amoung other myths) and Poseidon had Theseus (Who killed the minotaur). Hades didn't have many kinds of even any.
My reason for why their are 3 gods is perhaps because 3 is a magic number. Hope this helps.