It used to be very common to run clocks from the mains and the accuracy of the clock depended on the accuracy of the mains frequency. Although this is less common now since the quartz clocks became available, a lot of clocks in public buildings still do this because quartz clocks have to be adjusted regularly.
It is also very common to connect all generators to a grid of other generators and these have to be precisely on the same frequency and also in phase with each other. They also have to be producing the same voltage as the other generators.
Generator frequency is determined by the speed of rotation of the engine that drives the generator and this speed is set in much the same way as you set the speed on your car engine, by applying pressure to the gas pedal.
This happens automatically, though, and there may not be an actual gas pedal.