When an electric current flows in a wire it creates a magnetic field around the wire. By winding the wire into a coil we can strengthen the magnetic field. Electromagnets are made from coils like this.
We can make an electromagnet stronger by:
The magnetic field around an electromagnet is just the same as the one around a bar magnet. It can, however, be reversed by turning the battery around. Unlike bar magnets, which are permanent magnets, the magnetism of electromagnets can be turned on and off just by closing or opening the switch.
Relays are electrically operated switches. They use an electromagnet, often to control a high-power circuit using a low-power signal or where multiple circuits need to be controlled by one circuit.