In ecosystems, various organisms play distinct roles essential for maintaining balance. Consumers are organisms that obtain energy by feeding on other living things, while producers generate energy through photosynthesis, providing a crucial energy source for the ecosystem.