To survive, each organism must establish their own niche and avoid niche overlap. Competition amongst species presents a struggle for survival. The best chance that a species has to survive is to avoid competition while successfully obtaining resources.
An organism's niche includes how and where they obtain resources for survival. An organism's niche also includes what they contribute to the ecosystem! For example, beavers obtain sticks and logs to build dams for their home. But, the dam impacts the flow of the river and the other organisms that live in the ecosystem. Bacteria are decomposers that break down dead organisms. But, they also return minerals to the soil which supports plants! These roles in the ecosystem are part of the organism's niche as well.