How does it work?
An electromagnet works because an electric current produces a magnetic field. The magnetic field produced by an electric current forms circles around the electric current.
A list of sources
In order to find out about Electromagnets, for pictures I used google, for the video i used YouTube, and for the facts I used www.universetoday.com