Electromagnet
Electromagnets work because when electricity flows through a wire it makes a magnetic field around the wire. The direction of the magnetic field can be found by using the right-hand rule. This means that if a person points the thumb of their right hand in the direction of the current, the magnetic field would go around the wire the same way their fingers would wrap around the wire.