Mechanisms of Flagella
Flagella in prokaryotets is very different from that of eukaryotes.

The main structural protein in a prokaryotic flagellum is flagellin. The flagellar motion is caused by a molecular motor similar to Mitochondrial ATP-synthase; molecular motion generated by the chemiosmotic energy. 

Eukaryotic flagella or cilia are made of microtubules with dynein attached on to them and cause the movement by the energy generated by ATP hydrolysis.

See the wikipedia article. It is clear enough.