The size and make-up of a community depends on abiotic factors (non-living) and biotic factors (living).
Abiotic factors include temperature, light intensity, moisture level and the pH of the soil. Low temperature slows reactions in organisms, so growth is slower. Light intensity matters because plants need light for photosynthesis, so few plants can grow on a dark forest floor. Plants need water, so a dry area has fewer plants and fewer of the animals that feed on them. Soil pH affects which plants can grow, because many species survive only in a narrow pH range.
Biotic factors include the food available, predators, disease and competition. If food is scarce, a population falls. If predators increase, the numbers of their prey decrease. If a new predator or competitor arrives, the community can change.
To investigate a community, scientists use sampling, such as placing quadrats at random in an area and counting organisms. They calculate a mean, and can measure an abiotic factor at each site and plot a graph to see if there is a link.