Virtually all animals are aerobic, using a method of respiration that requires oxygen to efficiently shift energy from large molecules like glucose to the highly usable energy molecule ATP. That means that animal tissues require not just a continuous supply of fuel molecules, but oxygen as well. Respiration of most fuel compounds produces carbon dioxide, which is lost to the environment in respiratory systems. Respiration of proteins produces toxic nitrogenous wastes, which do not easily leave through respiratory surfaces and require specialized removal systems, dealt with below.
Oxygen is somewhat limited by how much is available from the environment. Aquatic environments contain oxygen, but oxygen has limited ability to dissolve in water, an ability that decreases with temperature (but generally, animal metabolic rates increase with temperature). Oxygen tends to have a much higher presence in air. When aquatic organisms were dealing with a movement onto the land, the higher oxygen levels would have been a negative, based upon oxygen's high chemical activity, but it was also an evolutionary opportunity; terrestrial organisms' metabolic rates rose with the new oxygen levels, to the point where those species that later became aquatic again rarely were able to be active breathing just water.
Of course, oxygen must reached the cells in order to be used. This can use the animal's outer surface for exchange - cutaneous respiration - but any such exchange requires a thin, wet surface. In aquatic animals, this is not an issue; in terrestrial animals, cutaneous respirers must live in wet and/ or extremely humid conditions that reduce water loss across the exchange surfaces. Entering oxygen must then reach internal cells. In small or flat animals, this can be accomplished with simple diffusion. In larger animals, no matter how the oxygen enters, some sort of distribution system is necessary. That has been discussed above.
Entry surfaces for larger animals are almost always increased in various ways. Gills, rather than being just flat, well-vascularized membranes, are generally invaginated, with the surface repeatedly folded inward; lungs, even though available oxygen levels are much higher, are often evaginated, folded outward to present a lot of surface-to-blood availability. Tricks to increase oxygen uptake from water often include countercurrent systems, with the blood flow going opposite to water flow through the gills - as water going through loses oxygen by diffusion to the blood, it continually passes oxygen-depleted blood, sustaining the concentration gradient.
With terrestrial animals, the tissue fluids will hold a very limited amount of oxygen compared to the air. There is a need to charge the blood, but not to fully deplete the air, which can't really be done - the blood will never hold an equal concentration to normal atmosphere of oxygen. Systems that use a lot of oxygen, or use it quickly, may increase surface with internal spaces filled with air, and may adjust how incoming and outgoing air does or doesn't mix.
There is a non-lung system used in insects. With an open circulation system that is not efficient enough to deliver oxygen quickly, they have tracheal system of dedicated tubes that connect all cells directly to the outside air. This gets lots of oxygen in when needed, but also is a lot of potential water loss, so the system under all but high-need conditions is to some extent flooded with fluid.