The aim of the present work is to study the magnetic properties of seminal materials such as magnetic semiconductors (part II) and weak itinerant ferromagnets (part III). Recently magnetic semiconductors are very much in the center of attention, in particular in the emerging field of spin-based electronics. Weak itinerant ferromagnets are also very promising materials because their ferromagnetism is not very stable and can easily be tuned by external parameters like pressure or stoichiometry. The investigations are done by applying density functional theory (DFT), one of the most powerful techniques for gaining a detailled understanding of real materials. In part I of this work a short introduction into the theory of electronic structure methods and magnetism is given. In part II two completely different magnetic semiconductors are discussed. The binary I/II-V compounds (prototype CaAs) in the hypothetical zinc-blende structure belong to the so-called concentrated magnetic semiconductors (CMS). CaAs and related I/II-V compounds might be prepared as thin films and in that form were very promising materials for spintronics. The second class of materials investigated, Cu$_2$O doped with Mn, Fe, Co, and Ni, belongs to the dilute magnetic semiconductors (DMS). The compounds derived from Cu$_2$O have already been prepared in experiment. They yield very diverse physical properties ranging from room-temperature ferromagnetism to spin-glass behavior. In part III metals in the perovskite structure are in the center of attention. First the series TCu$_3$N with $T$=Pd, Rh, and Ru is investigated. It is demonstrated that electron localization and magnetism can occur also for a material having 4d electrons, which is a very rare phenomenon. Subsequently AlCNi$_3$ and GaCNi$_3$ serve as examples demonstrating how tightly carbon stoichiometry and magnetism are connected. Mo-cluster compounds (prototype GaMo$_4$S$_8$) owe their interesting magnetic properties to well-separated Mo$_4$ clusters and narrow, partially filled Mo 4d cluster orbitals. Finally non-collinear magnetism, a highly challenging field, is touched by studying TNMn$_3$ with T=Cu, Zn, Ga, and Ge.