How does a spinning windmill produce electricity?What is the principle behind the windmill?
The short answer, as Karsus Ren says, is that it's electromagnetic induction that generates the electricity: the relative movement of a conductor and a magnetic field.
As Vladimir Kalitvianski points out, strictly speaking, windmills don't generate electricity - wind turbines generate electricity, and windmills mill grain. Still, it's become reasonably common to refer to wind turbines as windmills.
As Crowley says, a wind turbine takes the wind's horizontal motion, turns it into rotary motion, which in some (but not all) turbines then goes through a gearbox. The motion then (depending on the nacelle design) either:
a) rotates either a conducting coil (typically copper) through a magnetic field; or
b) rotates magnets around a coil;
either way, this generates electricity through electromagnetic induction.
The magnets may be permanent magnets (typically a neodymium alloy) or electromagnets.
The theoretical limit on how much of the wind's energy can be captured by the blades is called the Betz limit, and is an efficiency of ~59.3% (16/27).
The Danish wind-turbine manufacturer Vestas has some very accessible stuff on their e-learning site at http://www.vestaselearning.com/ It might seem banal at times, but don't be fooled - there is a lot of decent material in there.
Generating Electricity from wind uses the same technology that any generator does. BUT unlike steam, water pressure or gas wind is not continuous so its input is not constant. 1st of all the speed governor is critical if not the most important part of the device. 2nd the high wind failure mechanism is critical you ether design for say 60 mile H. or have the blades collapse. 3rd and not to be forgotten you need knowledge of wind patterns to calculate wind shadows. after all this you can calculate blade design and aerodynamics.
First kind of principles is 'How the linear motion is transferred into revolutionary': There are horizontal- and vertical-axis windmills, horizontal are more common, vertical ones doesn't care about the wind direction.
Second way how to sort windmills is by the principle of transfer energy conserved in axial flow into momentum. Easier way is based on resistance - the blade is usually steel plate - and is used in small and/or old windmills, Sophisticated windmills are based on wing lift - shape is like airplane's wing - and those are made of composites like fiberglass or carbon fiber. Vertical-axis turbines are based different resistance of the profile when the profile is moving against the wind and with it - easiest is S shaped plate.
And revolutionary motion is transferred through braking system (security), gearbox (to obtain exact frequency) into a generator (Alternator, dynamo, 3-phase generator). This part is almost the same as in any other power-plant. Except solar ones.
Nowadays most wind turbines are horizontal and based on wing-lift. They suppose that the velocity of the wind is 1/3 of the velocity in front of the turbine. Theoretical efficiency is about 46%, real one barely reach 29% (Output wattage / Energy flow into the windmill)
If you want some equations to support my numbers and/or describe the relation between profile parameters, wind characteristics and windmill design add comment, I'll find it out in my papers...