Theoretical Foundations of Molecular Magnetism