How is generator output voltage kept constant?
I am going to assume you are referring to wound rotor Synchronous generators. 

There are two main aspects to consider when you are dealing with such generators.


Field control
Damper Bars/Windings


To generate electricity the shaft obviously has to be rotated but there also needs to be some form of field on the rotor. This is provided by either brushes or a brushless (rotating diode) arrangement. This produces a DC excitation field on the rotor that can be controlled from the stators mechanical frame of reference (ie non-rotating)

What method is chosen is a system specific consideration but both provide means to control the rotor flux. Such a controlling system can be referred to as a Generator Control Unit (GCU) 

A certain rotor field for a given rotor speed will produce a certain magnitude sinus waveforms at the stator terminals (the frequency of that is related to the speed of rotor rotation &amp; the number of pole pairs on the stator).

The terminal voltage can thus be controlled via the strength of the excitation field. By providing a closed-loop controller that measures the terminal voltage w.r.t. a desired value, the terminal voltage can be maintained across the load range simply by varying the rotor's excitation field strength. 

Damper bars/windings are a secondary means to help facilitate the terminal regulation. They are buried deep within the stator winding slots and essentially they aim to short-circuit the magnetic circuit in the event of high di/dt which may occur during load applying or shedding. This help to mitigate massive terminal over-voltage (load-shedding) or machine stalling (load applying) until the GCU control loop can "catch up"