Windmills as an alternative energy source must, to fulfill the current purpose of most windmills, generate electricity. Historically, windmills were used for other purposes, and some might still be found performing other tasks. They can be used to pump water from an aquifer, roll stones to grind grains, or any of a myriad of other mechanical purpose that requires a force to perform work. But, our main interest in windmills today is to generate electricity. And they can perform this duty quite well.
Basically, when an electric charge passes through a magnetic field, it experiences a force, depending or is magnitude, and the speed at which it moves perpendicular to the magnetic field lines. This force is at right angles to both the movement of the charge across the magnetic field and to the magnetic field itself. As an easy way to view this, if there is a magnetic field that is oriented north to south, and the movement of a charge is horizontal along the line from east to west, the force of the charge will be vertical, and thus change the path of the charge. Well, the choice of directions here is arbitrary, but the force is perpendicular to both the field and the movement relative to the field.
A windmill turns a coil of wire through a magnetic field. In any metal there are electrons that move from atom to atom freely, so they are free to be moved. As the coil or wire spins, it goes through a magnetic field. Opposite sides of the coil go through the field in opposite directions, so that causes the electrons to flow upward in one side of the coil, and downward in the other, or to move around the circle of the loop. The electrons are constrained to the wire. The moving current is taken off using conductive brushes, and can be made to flow in a circuit.
Notice that as the coil of wire spins it cuts the magnetic filed from parallel to the field, or no field lines crossed meaning no force, to perpendicular to the field, or a maximum force. The result is alternating current in a sinusoidal shape.