How bacteria maintain location and number of flagella?

How bacteria maintain location and number of flagella?