Mechanisms of breathing vary among different groups of animals depending mainly on their habitats and levels of organisation.
Lower invertebrates like sponges, coelenterates, flatworms, etc., exchange O2 with CO2 by simple diffusion over their entire body surface.
Earthworms use their moist cuticle and insects have a network of tubes (tracheal tubes) to transport atmospheric air within the body.
Special vascularised structures called gills are used by most of the aquatic arthropods and molluscs whereas vascularised bags called lungs are used by the terrestrial forms for the exchange of gases. Among vertebrates, fishes use gills whereas reptiles, birds and mammals respire through lungs.
Amphibians like frogs can respire through their moist skin also. Mammals have a well developed respiratory system.