Air flowing from zones of high pressure to zones of low pressure causes winds, just like the way air gushes from a punctured tire or balloon. Uneven heating and convection generate the pressure differences; the same tendencies create currents in a saucepan of water heating on a stove. The difference in this case is that the convection currents that create winds take place on a far greater scale.
Warm air expands and becomes less dense, causing it to rise, while cold air contracts and becomes more dense, causing it to sink. In regions where the air is warm, it will rise and cold air will rush in beneath it to take its place. As the warm air rises, it cools down, eventually sinking back to the ground in another location. The currents created by these tendencies are called convection currents.
Earth's surface is heated unevenly by the sun. The Earth's axis of rotation is at a tilt with respect to its orbit; the hemisphere pointing toward the sun experiences summer, while the other hemisphere experiences winter. Regions near the equator receive more sunlight over the course of the year than any other region. This uneven heating creates gigantic convection currents that transport heat north and south away from the equator; these currents are called Hadley cells, and the winds they generate are called trade winds.
Sciencing Video Vault
Another important factor is the difference between ocean and land. The land heats up and cools down more rapidly than the sea. On a day-to-day basis this creates so-called sea-land breezes. In the day, the land heats up rapidly, so air above the land rises before flowing out to sea, while cool air above the sea sinks before flowing back to land. The result is a cool "sea breeze" blowing inland from the ocean. During the night time, by contrast, the sea is warmer than the land, so the pattern is reversed and the breeze now blows back out to sea.
On longer-time scales, the difference between sea and land drives large-scale wind patterns like monsoons. During the summer, the sea is cooler than the land, and moist air flows from the ocean to the coast, often causing heavy rainfall. During the winter the pattern is reversed, just as with the daily sea-land breeze. There are many other interesting local and regional wind patterns that develop, but all of them have this in common: They are caused by uneven heating of Earth's surface by the sun.