Why does the vegetation vary from place to place on the earth?

Environment issues are the cause of the variation. The local climate should lie within certain bounds for the following variables: - temperature, soil moisture, rainfall, wind regime, soil types including such things as pH,and lime or iron values.

At higher altitudes the UV will be stronger, and the sunlight intensity likewise.

Certain plants need a low pH and others a higher pH.

Some plants want a swamp life (or even salt water such as Mangroves and seaweeds).

Some plants like a desert.

Mountain plants must be able to stand high winds, and low temperatures.

And some plants need a rich soil, and others a stony one.

Many plants are quite tolerant, and the main needs are water and sufficient sun.

And of course, flowering plants need insect fertilization, sometimes a very particular bee or wasp (check Brazil Nuts, and Figs). And trees with large seeds may need birds to carry their seeds to distant places.