A cycle ergometer is connected to a generator to convert the mechanical energy from pedaling into electrical energy. The cyclist powers the generator by pedaling the ergometer, which turns the generator and produces electricity that can be used or stored. This setup provides a way to generate electricity through human power by cycling.