Earthworm - Circulatory System
The earthworm like many more complex organisms has a closed circulatory system, meaning that its blood is confined to blood vessels and its blood is recirculated so it gets maximum use. An earthworm has neither lungs nor gills but uses its body's great surface area to absorb oxygen from the soil. The oxygen is taken in by the dorsal blood vessel and travels to the five aortic arches (hearts) by the esophogus where it is pumped to the lower, ventral blood vessel. The ventral blood vessel pumps the blood to all segments and organs in need of oxygen. In each segment, there is a small blood vessel that sends the blood from the ventral blood vessel back to the dorsal blood vessel, thus completing the loop (Musurca).
1) Anus 2) Dorso-subneural vessel 3) Intestine 4) Dorsal vessel
5) Hearts (aortic arches) 6) Mouth 7) Ventral vessel 8) Subneural vessel
Picture retrieved from http://www.student.loretto.org/zoology/phylum_annelida.htm
Since an earthworm gains oxygen through moist soil and holes in the soil, it will die if the soil is either too dry or too wet (such as after a heavy rainstorm). That is why worms will surface in these extreme situations.