They meet and fall in love, then the dead organism leaves, making the iving one depressed, then they come back and fight with another living organism for the living organism they love. The dead one wins and they get married, then they have a half-dead baby and the living organism becomes a dead one and they all live happily ever after, including the other living organism because it falls in love with the half-dead baby.
That varies from organism to organism. Some examples are: plants manufacture their food using a process called photosynthesis from light, carbon dioxide, and water browsers and grazers eat plants carnivores hunt, kill, and eat other animals fungi and some bacteria decompose dead plants and animals some bacteria "eat" inorganic chemicals like iron, sulfur, etc. etc.
The diversity of functions an organism can hold in its environment, and the diversity of habitats in which it can live. (Example) A shark is very niche diverse because it can live in an environment with live fish and eat them, or an environment with mostly dead fish and just eat the dead ones. That's why sharks are "living fossils."
An organism that eats another organism in order to live is called a consumer. If they eat plants they are a herbivore, If they eat animals they are a carnivore, If they eat both plants and animals they are an omnivore. the organism that eats the other is called the predator, the animal being eaten is called the prey.