The air close to the earth's surface is heated by light energy from the sun, and after the air is warmed it becomes less dense and rises upward. The result is that the air near the earth's surface maintains a temperature in which life can exist. If air contracted when heated and became denser, the temperature on the earth's surface would become unbearable, and most life could not survive for very long.
The temperature a few hundred feet above the surface, on the other hand, would be extremely cold, and most life could also not exist there for very long. The only habitable region would be a thin slice of air, but even here life could not exist for long because the plants and trees necessary to support life in the atmosphere could not survive, as they would be in the cold zone. Thus birds would have no resting place or food, water, or oxygen. But because air on the earth's surface rises when heated, life can exist on the earth.
The movement of warm air from the surface rising upward creates air currents (wind), which are an important part of the earth's ecological system. They carry away carbon dioxide from areas that overproduce, such as cities, and move oxygen to areas in need of it, such as the large urban population centers.
The mixture of gases usually found in the atmosphere not contaminated by human pollution is perfect for life. If it were much different (e.g. 17 percent instead of 21 percent oxygen, too little carbon dioxide, etc., or the atmospheric pressure were much higher or lower), life would cease to exist on earth. If our atmosphere were much thinner, many of the millions of meteors that now are burned up would reach the earth's surface, causing death, destruction, and fires everywhere.