Magnetic fields on the surface of the Sun and stars in general imprint or modify the polarization state of the electromagnetic radiation that is leaving from the star. The inference of solar/stellar magnetic fields is performed by detecting, studying and modeling polarized light from the target star. In this review we present an overview of techniques that are used to study the atmosphere of the Sun, and particularly those that allow to infer magnetic fields. We have combined a small selection of theory on polarized radiative transfer, inversion techniques and we discuss a number of results from chromospheric