Now, the angular momentum of an electron is a vector quantity, meaning it has direction. The motion of the electron produces a current, which in turn generates a tiny magnetic field in the direction given by the angular momentum. Thus an atom can behave like a dipole, meaning "two poles". The direction of the orbital and spin angular momentum of the electron determine the direction of the magnetic field for the electron and the entire atom, thus giving it "north" and "south" poles. Different atoms have different arrangements of electrons into their orbits, and thus have different angular momenta and dipolar properties.
A ferromagnetic material is composed of many microscopic magnets known as domains. Each domain is a region of the magnet, consisting of numerous atomic dipoles, all pointing in the same direction. A strong magnetic field will align the domains of a ferromagnet, or in other words, magnetize it. Once the magnetic field is removed, the domains will remain aligned, resulting in a permanent magnet. This effect is known as hysteresis.
Few materials are actually ferromagnetic; however, all substances have a diamagnetic nature. Diamagnetism means that the molecules within a substance will align themselves to an external magnetic field. The external magnetic field induces currents within the material, which in turn result in an internal magnetic field in the opposite direction. This effect is usually quite small and disappears when the external magnetic field is removed.
Some materials are paramagnetic. This is the case when the orbital and spin motions of the electrons in a material do not fully cancel each other, so that the individual atoms act like magnetic dipoles. These dipoles are randomly oriented, but will align themselves to an external magnetic field. However, when the field is removed, the material is no longer magnetized. Again, this effect is typically small. Neither diamagnetic nor paramagnetic materials exhibit magnetic domains.
The atomic behavior of magnetic materials is actually considerably more complicated than this, as it relies on the theory of quantum mechanics. Quantum mechanics is the theory of physics used to describe the behavior of tiny particles such as electrons; like electromagnetic theory, it is complex and involves advanced mathematics.