Chemical elements take different forms in the environment. Inorganic compounds form organic compounds that can break down once again to inorganic compounds. For example, carbon, oxygen, nitrogen, sulfur, and other elements combine in various oxidized or reduced states. The processes of life incorporate them into organic molecules. With death and breakdown of organic materials, these elements escape back to the air, land, or water for potential recycle. We can also consider food chains, although food web is perhaps a better term, in which tiny animals feed on tiny plants, only to be consumed by bigger ones. Those that die provide nutrients for other plants and animals or decompose and enter the chemical cycles mentioned earlier. An animated sketch of the cycling of an element in nature should be a useful teaching exercise.
Another way to envision an ecosystem is through its energy flows. Sunlight powers the photosynthetic organisms that are the primary producers in a food web. At every step, some heat is evolved. The life forms represent a small fraction of the energy powering an ecosystem.
A little ecological terminology is useful. Habitat refers to location, and niche refers to speciality. Let's make an analogy with persons. If Dr. Jones is a surgeon residing on Main Street, his habitat is Main Street and his niche is surgery. Of course, we could be more specific. An organism might have a habitat in the bottom muds of brackish ponds and its niche might be conversion of organic molecules with sulfonic functions to mercaptans.
There is an important distinction between organisms that can manufacture all their complicated biochemicals from a few simple elements and carbon dioxide and those that require preformed compounds. An autotroph needs no other life forms to supply its needs, but a heterotroph must have biochemicals produced by living organisms although the immediate source may be dead or decaying matter. Chemotrophic organisms derive their energy from chemical oxidations and reductions.