There are volumes of books written on this subject.
You control the speed of a prime mover (steam turbine, gas engine,etc.) that turns the generator to control frequency or real load depending on if the generator is supplying in parallel with other sources (like the utility grid) or isolated island. This control is usually with some type of a governor valve for the prime mover that uses a PID control system.
You also control generator excitation with a voltage regulator to control voltage output of the generator. Supplying the utility the voltage is used to control reactive load on the generator and when isolated it will directly change the output voltage.
Try to understand the steps taken and how a generator is synchronized to the utility grid.
1.match voltage and frequency
2close generator output breaker when in sync with utility( phase rotation matched)
3.Increase the load on the prime mover (open the govenor valve more) to "pick-up load" KW adjust voltage contorl for KVAR load.
Again you control the speed and the excitation of the generator with variations of classic control system methodology.
You have to think of what is going on when the generator is sharing load in parallel or is the only source suppling the load. Hope this helps.