Direct-current types
The electromagnets can use direct or alternating current. The type with which you are probably familiar is the direct current electromagnet.
You can build a direct current electromagnet by taking a large bolt, like a stove bolt, and wrapping dozen or a few hundred turns of wire around it. These items are easily available in almost any hardware store. Be sure that the bolt is made of ferromagnetic material. (If a permanent magnet sticks to bolt, bolt is ferromagnetic.) Ideally, bolt should be at least 3/8 inch in diameter and inches long. You are required to use insulated wire, made of solid, soft copper. Bell wire works quite efficiently.
Just be sure all the wire turns go in the same direction. A large 6-V lantern battery can give plenty of direct current to work the electromagnet. Never leave the coil connected to battery for more than seconds at a time. And never make use of a car battery for this experiment.
Direct-current electromagnets posses defined north and south poles, similar to permanent magnets. The main difference is that the electromagnet can become much stronger than any permanent magnet. You should see proof of this if you perform the above experiment with a large enough bolt and appropriate turns of wire.