Energetics of flagellar rotation in bacteria