A generator works by utilizing a magnetic field and the motion of a conductor to generate electrical energy. When the conductor, typically a coil of wire, rotates within a magnetic field, it induces a current in the wire.