How They Work
All electrified wires produce a magnetic field that radiates out from the wire. In most cases, the field is too weak to have any affect. A magnetic field can be concentrated by wrapping the wire concentrically so the fields of adjacent wires overlap, increasing their power. Wrapping the wire around an iron core amplified the effect dramatically.
Voltage
An electromagnet can only produce a magnetic field when current passes through the wire. The gauge of the wire determines how much current can be applied to an electromagnet. The gauge of the wire is its diameter. Wire gauge is measured with smaller numbers indicating larger sizes. Larger wires can accommodate more electrical current.
Resistance Capacity
Copper wire, for example, is a highly efficient conductor of electricity, but it still has some resistance to electrical flow. Resistance generates heat. When an appropriate-sized wire is used for any given application, the current used in the wire never approaches the resistance capacity of the wire, which could destroy the wire and any connected components, and even start a fire. So, the wire used in electromagnets varies based on the amount of current the electromagnet is designed to handle. However, there is an additional consideration when dealing with electromagnets.
Voltage Spikes
Electromagnets are inductors, meaning that electricity is stored in the windings of a magnet. Abrupt changes in current -- including simply turning the electromagnet off -- can cause a large voltage spike as the current discharges. There are several ways to mitigate the discharge of this stored energy, such as a capacitor designed to store the excess energy. The wire gauge on your electromagnet must be able to withstand not just the current you plan to flow through it, but the potential discharge from electrical induction.