Alternators / generator use a rotating magnet built into flywheel and magnet coils ( stator ) as the magnets pass the stator they generate a current in the coils , with enough rotation and enough coils there is enough generation of electricity to power the bike , use the lights and recharge the battery which is used to start the bike when the engine is stationary the current created is AC to convert to DC the current must first pass through the voltage regulator and rectifier .
The voltage regulator restricts voltage to 14v and converts AC to DC these can fail, they contain a series of diodes that restrict voltage and convert to dc via a rectifying bridge see the post on this in index.
Below is some test on testing the coils see other post for how to test charging system with the bike running and also.
Alternator coils testing
Set multimeter to ohms , test measurements between all three yellow wires and then all yellow wires to earth , the number og coils and colours oif wires may differ on your model