Natural magnets occur in many areas of the world and have been used in China since at least 2,600 BC. These natural magnets are no longer used because it is easy to make artificial magnets. Electromagnets exist only as long as the electricity is on. Non-electric artificial magnets can be more permanent--depending on the material that is used to make them.
Create an artificial magnet by using electricity. When electricity flows through a wire--for example, when the wire is connected to a battery--a magnet field is generated around the wire. You can intensify this magnetic field by coiling the wire so that the overlapping magnet fields reinforce each other. The coil is an artificial magnet as long as the electricity is flowing.
Insert a metallic core into the coil of wire to concentrate the magnetic field. This system of power supply and coil of wire around a metallic core is known as an electromagnet. For most common metallic cores, most of the magnetism goes away when the electricity is turned off.
Construct an electromagnet by attaching both ends of a long wire to a battery and then coiling the center part of the wire around a large nail or a metallic bolt. When both ends of the wire are attached to the battery and electricity is flowing, the metallic core will act like a magnet--picking up small metallic objects. When the circuit is broken--by disconnecting a wire--the small objects will fall. The electromagnet is a magnet only as long as the electricity is flowing.
Make a more permanent artificial magnet by choosing a specially designed substance to make an electromagnet. Two of these substances are alnico and permalloy. If you make an electromagnet using one of these substances--and leave the electromagnet turned on for a while--the core remains magnetic after the electricity is turned off.
TL;DR (Too Long; Didn't Read)
The more winds of wire in the coil of an electromagnet the stronger the magnet will be. The higher the current is in the wire surrounding the core of an electromagnet, the stronger the magnet will be.
Do not use alternating current (AC) to create an electromagnet. With AC the current flow reverses many times a second and so the magnetic field also reverses many times a second. Direct current (DC) is better for making magnets. If you are trying to make a really strong artificial magnet you should be careful not to put too much current through the wire as too much current can heat the wires to the melting point. It is better to create strong magnets with more turns of wire around the core--possibly in several layers.