Flagellum is a structure in bacteria that gives them the ability to move. The motor of flagellum comprise of a system of rings planted in the plasma membrane and cell wall. Protons are pumped out of the bacterial cell by the electron transport chain but diffuses back into the cell providing the force to rotate the filament and move the cell. The photo shows a diagram of the structure of flagellum in gram negative bacteria and a close-up electron microscope image of the motor system of flagellum.
Urry, Lisa A.. Campbell Biology (p. 574). Pearson Education. Kindle Edition.