How are magnets and magnetic fields related to electricity generation?
Changing magnetic fields in a region of space, generate electric fields. If a closed loop of conducting substance is present in the area, we can naturally expect an emf and thereby a current in it.
The above property of magnetic fields is exploited by modern day electric generators. The phenomena is known as electromagnetic induction.
In an electric generator, electromagnets are made to revolve around a closed loop. In such as case, the field (strictly, magnetic flux) through the loop changes with time and thus, an EMF is generated in it which produces an electric current.
Wires are used to draw the electric current from the loop and thus used for various applications.