The various forms of Divine manifestations of God as deities are derived form the scriptures called Agamas and based on the Ithihãsãs and Purãnãs. The idea that every deity whom men worship is the embodiment of a limited ideal, and that the deity is a symbol of some aspects of the Absolute is one of the most fundamental characteristics of Hinduism. It is this idea that makes Hinduism the most tolerant of religions accepting alternate beliefs and averse to proselytization.
The three important functions of the Supreme are Creation, Protection and Destruction or Dissolution. These came to be established in popular imagination as the Hindu Trinity - Brahma (NOT the Supreme Brahman of the Upanishads), Vishnu and Shiva. The power associated with these gods came to be personified as their respective consorts. So Creator Brahma's consort is Saraswati (the goddess of Speech and Learning), Protector Vishhnu's consort is Lakshhmi (the goddess of wealth and prosperity), and Shiva's consort is Shakti (the goddess of power).
The simple equation here is that creation needs knowledge, protection and preservation needs wealth and prosperity and destruction and power or energy are linked together. Since Vishnu is the protector, He is the One who can take on an avatãra, taking human form whenever the world order is disturbed by a colossal form of evil. So, whenever the evil forces show ascendancy, God manifests Himself in various forms to protect the humanity and preserve the righteousness in the society.
The gods were then provided with their own heavens, attendants, vehicles and even progeny. The more intelligent among the people understood this symbolism, but to the masses, the symbols formed an end in themselves. So, the various levels of understanding is accepted and the faith provides the proper level of devotion to the people the way they can understand them for a peaceful life. The symbolism is common to all Hindus, but the exclusive emphasis on a particular god or goddess in this scheme at a later time gave rise to the four major sects in Hindu Religious practice.
They are Shaiva (worshipers of Shiva), Vaishhnava (worshipers of Vishnu) and Shaakteya (worshipers of Shakti). Those that do not belong to these three sects nor go by their sectarian scriptures (Ãgamã), but go by the ancient traditions (Smrutis) and worship all gods without any exclusive preference came to be known as Smãrtas. However, all sects teach that the particular name and form of their deities are limitations, just one aspect of the Supreme Divinity, which we, in our weakness, impose on the all-pervading Brahman.
Even the highest theism is regarded only as a sort of glorified anthropomorphism. The worship of a personal god is taught to be only a halfway house in a man's journey to the Ultimate Reality. However, the idea of a personal god is the most important prop for the mind to contemplate upon it. Hinduism acheives unity in diversity by cherishing the many ways in which men have represented and worshipped the various aspects of the Supreme as various Deities manifesting to perform a specific activity.