The understanding of how biodiversity affects an ecosystem involves entire chapters on the subject. Despite the fact that it is a vast topic, fair idea of it can be obtained if certain key entities and the relationship between them are understood. As it is clear from the concerned topic, the terms biodiversity and ecosystem have to be understood. It is the kind of relationship between these two that describes the affect of one on the other.
The diversity in genes within species, diversity in species within habitats and diversity in habitats in within a region is referred to as biological diversity or Biodiversity.
Ecosystem is made of biotic and abiotic components. Animals, plants and microbes are called biotic components while natural resources such as air, water and soil that are needed by biotic components to thrive are collective called abiotic components. Ecosystem is the term that is used to denote a community of biotic components along with abiotic components in a particular region. Ecosystems can be small and simple as well as vast and complex.
The integral relationship between biodiversity and ecosystem is already evident from the descriptions of each. Biodiversity forms food web in ecosystems. The interrelation of species in the food web can be seen as a measure of the complexity of the ecosystem, though there is no precise to determine that. Biotic components depend upon each other for their supply of food. If one or more species that dominate the food web get extinct or face extinction, the entire network gets disturbed. The worst case scenario in most severe cases could be irreversible chain-reaction of extinction of species.
Plants are called producers as they are the ultimate source of energy in any ecosystem. Plants derive nutrients from soil and produce their own food through photosynthesis. No other member of biotic community is capable of producing its own food. Animals are herbivorous or carnivorous and called consumers. Herbivores obtain food directly from plants while carnivores eat herbivores to get their share of the nutrients produced by plants. As animals die, microbes feed on them and, in the process, decompose their body. The discharge of microbes is the nutrient that plants absorb from soil. Thus, even the simplest relationship is actually quite complex.
Besides, plants depend on animals for pollination and dispersion of seeds. Different species of animals eat different species of plants. Similarly, different species of animals have different habitats in an ecosystem. If an animal-species becomes extinct or endangered, the reproduction of the dependant species of plant gets affected. However, richness in biodiversity eliminates 1:1 dependence and ensures that loss one species will not endanger the dependant species. It is a simple explanation of how biodiversity affects an ecosystem. However, there are other factors such as resilience that affect biodiversity and its impact on ecosystems.