How does biodiversity contribute to the sustainability of an ecosystem?
The more diversity there is in an ecosystem, the more it is likely that several species have the same function in that ecosystem's balance.
In a ecosystem, there are several species interacting with each other.
A good example of those function could be a trophic network (fig 1) with prey, predators and primary productors where every member of that comunity has a dynamic of population with natality and mortality that has a more or less stable balance.
fig 1) a simplyfied trophic network
If for any reason, natural or anthropic, a species is to vanish from the ecosystem and if the said species was bearing a function in the ecosystem, the whole ecosystem could suffer from the disappearance. Indeed if you remove any member of the simplyfied network above, every other spicies would suffer from a lack due to a cascade reaction in the network.
In the orther hand, a richer ecosystem that would have several species bearing the same function would be more resilient to a vanishing species since no function would dissapear.