Wind is nothing more than moving air, so when you ask how wind is formed what you are really asking is how nature puts air in motion. The answer involves the sun, the earth, the air, and some basic principles of thermodynamics. 
The Simple Answer
Air disturbances are created when the sun heats the atmosphere unevenly. The warmer air expands and has less pressure than the cooler air that is surrounding it. The air will then move from the higher pressure to the lower pressure creating wind. The greater the variance in pressure, the faster the wind blows. 
The Sun Heats the Atmosphere Unevenly
There are a variety of reasons that the sun heats the atmosphere unevenly. The sun heats surfaces like concrete or land more quickly than it does water, so the air over those surfaces also heats at different rates. The atmosphere near the equator heats more than that near the Earth’s poles, because the equator is physically closer to the sun. In any case, when the air in the atmosphere is heated, it rises, leaving a pocket of low pressure underneath of it. Air from the surrounding atmosphere rushes into this area of low pressure, and you feel the rushing air as wind. 
The Dynamic Atmosphere
The atmosphere is a very dynamic place. If the heated air rose and stayed high in the atmosphere, you would feel a single gust of wind and then the air would be calm. But as the warm air moves higher in the atmosphere and away from warm surfaces, it cools and gradually sinks. Eventually, it will approach the Earth, be warmed again, and rise again. The rate at which the air warms and cools determines how strong the wind is. Air that is warming and rising very quickly creates large pockets of very low pressure, where the surrounding air can rush in very fast, creating the strong winds you sometimes feel with storms. When the air warms and rises slowly, you experience a calm, still day, and may even wish for a little breeze. 
The National Center for Atmospheric Research
What Is Wind?
Lehigh University Environmental Initiative
How Is Wind Formed?
 Cornell Center for Materials Research: Ask a Scientist
Air Temperature Creates Wind
 Atmospheric Sciences University of Illinois at Urbana-Champaign