Materials are magnetic if their valence electrons align in a special way. This is most likely to happen in transition metals, since they have many loosely held valence electrons. Iron, cobalt and nickel are often magnetic. The earth's iron core makes it a giant magnet, and the terms north and south are used to describe the two directions of a magnetic field. The north pole of a magnet is attracted to the earth's North Pole.
Compounds can also be magnetic. An iron ore with the formula Fe3O4 found in Magnesia, Turkey was called magnetite, and its name because associated with the unusual property. In medieval times the rock was called lodestone (since it will "lead" north) and it was used for navigation. People discovered that iron or steel needles could be rubbed on the rock to acquire magnetization. These needles were made into navigational compasses.
Ceramic magnets such as iron, cobalt, and chromium oxides are manufactured by powder metallurgy. Small particles can be mixed with polymers to make flexible refrigerator magnets, or coated on plastic strips to make audio and video recording tapes. Strong magnetic fields are applied during processing to align the fields of the particles. Deposition of thin films in a vacuum chamber is used for computer hard drives.
Alloys can make very strong magnets. The first successful combination, aluminumnickel-cobalt, was discovered in the 1930's. Alloys containing rare earth elements are even more successful. Samarium cobalt and neodymium-iron-boron are two common combinations.
In the early 1800's it was discovered that electric current running through coils of wire creates a magnetic field. Electromagnets are used in electric transformers.
Magnetism may be lost when a material is heated. Upon heating the electrons gain energy and can reorient, losing their special alignment.