An ecosystem is a community of organisms interacting with each other and with their non-living environment. The niche of a species is its role there: what it eats, where it lives and how it interacts with other species.
Biodiversity is measured at three levels: the range of ecosystems and habitats, the number of species and how evenly their individuals are shared out, and the genetic variation inside each species.
You cannot count every organism, so you sample. Samples must be random to avoid bias. Quadrats measure abundance, transects show how species change along a line, and mark-release-recapture estimates the numbers of animals that move. Statistics then test whether two variables are linked.