Magnets attract iron or steel due to their magnetic fields. The ability to attract iron and steel makes magnets useful for everything from holding a note on the refrigerator to picking up cars and moving them around in a junk yard. Magnets can even generate electricity and, conversely, electricity can create a magnetic force.
One property of a magnet is its ability to attract other materials. Magnets don't attract just any material, though. They attract only specific metals. Aluminum is immune to a magnet's charm, as are most other metals, like copper and silver. But nickel, iron and cobalt are all attracted to magnets, along with alloys, or mixtures of these metals with other metals, such as those you find in minerals. Ferromagnetic minerals such as magnetite and pyrrhotite along with a few other minerals are magnetic because they have a significant amount of iron in them. Weakly magnetic minerals, called paramagnetic, usually have slight amounts of iron impurities in them, such as hematite. Magnets even repulse one mineral, bismuth. Bismuth is diamagnetic. It's important to note that these materials are not magnets, but magnets attract the opposite pole of another magnet and repel a similar pole.
Permanency and Transference
Magnets are either permanent or temporary. A permanent magnet retains its attractive force over time. However, electromagnets stop being magnetic as soon as the electricity stops flowing. Electromagnets are temporary magnets. Another type of temporary magnet is one created by contact with another magnet. This ability to create magnets from other magnets is another property of magnets called transference. Line a needle up in the same direction as a magnet and stroke it along the magnet in one direction, and you will temporarily magnetize the needle. You have aligned all the poles in the pin by brushing it through the magnetic field; in fairly short order the fields become random again.
All magnets have a polarity; one pole emits the field while the other end pulls it back in. Natural magnets always have two poles. Depending on the shape of the magnet and the closeness of the poles, the shape of the magnetic field will change. A bar-shape magnet forms an apple-shap magnetic field around the bar, while a horseshoe-shaped magnet will keep the magnetic field between the two poles. Even electromagnets have two poles. To find the polarity of an electromagnet you wrap your right hand around the wire with your thumb pointing in the direction of the current. Your fingers are now emulating the magnetic field created by the current and are pointing in the direction of the magnetic field.
Magnets retain their polarity over time. The molecules that make up the magnet are all aligned in one direction, creating the magnetic field and it would be difficult for them to turn as a unit in the other direction. This is not true of electromagnets. Electromagnets can change the polarity simply by changing the direction of the electric current. The Earth has a magnetic field that protects the earth from charged particles emitted by the sun. Earth's liquid nickel-iron layer, stirred by the solid core of the Earth, creates an electrical field that creates a magnetic field. Because this magnetic field is a fluid, it is easier for the field to reverse polarity. This happens about every 200,000 years, according to National Geographic, and the last time it flipped was almost 800,000 years ago. In addition, the magnetic field of the Earth has weakened in the last 200 years, leading scientists to speculate that we are moving into another pole reversal.