Yajna is an act of sacrifice. Agni is the usable energy that can be shared, transferred etc.
Giving matter/materials to Agni is Yajna. This Universe is a Yajna, act of sacrifice.
In the Yajna of the Universe, matter is offered to Agni (usable energy), resulting in evolution of more complex and intelligent forms of matter and beings. Thus Universe is a system of sacrifice where lower order beings become the energy source (agni) of higher order beings. Vedas talk about this Universe's Yajna, which is cosmic science.
The human Yajnas are modeled after the Universe's Yajna. These human Yajnas are described in the Sutras, purAnas and itihAsas which came to describe/analyze/understand/derived from the Vedas.
The human Yajnas have offering (materials/matter) to fire/Agni called havis. The offerings (havis) in these Yajna can be rice offerings, milk offerings (ghee), Soma or pazu. Based on the havis, Yajna can be in four types. iSTIs (rice based and can include other offerings too), Pazuka (animal), ajya (ghee) and Saumika (Soma).
But when it comes to pazuka, it is not that the animal is thrown into fire. For eg. Ramayana describes Aswamedha Yajna in which a captured horse, let to roam on its own in the grasslands for a year, is cut three times by the queen, bled to death and its omentum is roasted and smelled.
In my view this could be a very scientific ritual based on human experience, performed in those days as omentum of such a horse that is not domesticated (but from a well bred one) has great medicinal properties. I will share some of my understanding on why they could have done that in another OP.
In general, every ritual or tradition evolves over a period and comes up for a very specific reason. Like us, our ancestors are also not fools to create something just for the sake of it. So what they created had great value for their time. But as time moves on and environment changes, the tradition remains and seems out of place or cruel or idiotic. It is our responsibility to understand the reasons and evolve the traditions.
I agree with Dayanand Sarasvati that Vedas do not talk about animal sacrifices at all.
-TBT