Devas exist in the five elements (earth, water, air, fire and ether) in this world. In Svarga Loka, they have an individual form. They do not have bodies physically constituted like us by five elements but have effulgent forms. They do not need material food to survive as we do. But they depend on humans for their well-being, which is provided by the performance of various Yagnas (Vedic rituals). They also have desires and needs. Although they are superior to us, their power is limited. In the case of worshiping Devas, yagna means offering libation to each Deva through mantras. Like substances offered in sacrifice, the words of these mantras constitute food for the Devas, helping them to keep their power. In Yagna, the chant of a particular mantra pertaining to a particular Deva invokes that Deva. Only oblations made through Agni (fire) along with the chant of the prescribed mantra will be in a desirable form for the Devas to receive.
Agni converts the oblation to a suitable state before passing it on to the Devas, precisely the way the digestive organs convert the gross food we eat into different forms before absorption by body systems. These yagnas to the Devas have threefold advantages. One is to ensure our well-being and the well-being of those around us through the grace of the Devas while living in this world.
The second advantage is to live happily after death in the worlds of the Devas. This life in the world of the Devas (Svarga Loka) is not forever. We can live only as long as our merits last. The happiness and enjoyment is in no way comparable to the total bliss of the union with Brahman. Nevertheless, life in Svarga Loka is paradise compared to the existence on Earth. Thus performing Yagna with a desire for happiness of paradise is suitable for some of us.
The third is the most important advantage, that is, performing yagna without desiring any rewards and gains. It is the way to purification of the mind. Even in a state of enlightenment, ego is not destroyed. It is there in a satvic (purified) form. Similarly, the mind is also controlled by the dictates of pure reason. When this happens, the mental process is out of bondage and becomes a basis for doing good to the world. This in turn takes the seeker on the path of knowledge, whose destination is Mukti or total bliss. In short, the seeker merges with the Infinite.
There are several types of important Yagnas such as the Rajasuya Yagna, Asvamedha Yagna, Putrakameshti Yagna, Sarpa Yagna, Satra Yagna, and Svargarohana Yagna. In ancient times, several emperors performed the Asvamedha Yagna (the horse sacrifice). For example, Sri Rama, Yudhisthira, Pushyamitra Sunga, Vikramaditya and Salivahana all performed this Yagna, which is performed to channel the energies of the performer and to unite the people of the empire.
Rajasuya Yagna is performed by kings in order to establish their emperorship, to integrate factions under their rule, and to distribute wealth to many people. Yudhishthira of the Pandavas performed this Yagna. Sri Rama and his three brothers were born as a result of Putarakameshsti Yagna undertaken by King Dasaratha of the Ramayana. Also, in Mahabharata, we learn that the King Drupada did this Yagna, the result being the birth of Draupadi and Drishtadhyumna.
Janamejaya, the son of Emperor Parikshit of Mahabharata, did Sarpa Yagna to eliminate all serpents from the Earth. He was consumed with anger because of the death of his father by a great serpent. Of course, it was stopped by the Devas since it was unnatural and against nature. This gives an idea about the kinds of Yagnas one can do. There are also simple Yagnas that give small results. More often than not, Yagnas are performed to do good to the humanity.