Polar compensation can play an important role in the determination of interfacial electronic and magnetic properties in oxide heterostructures. Using x-ray absorption spectroscopy, x-ray magnetic circular dichroism, bulk magnetometry, and transport measurements, we find that interfacial charge redistribution via polar compensation is essential for explaining the evolution of interfacial ferromagnetism in LaNiO3/CaMnO3 superlattices as a function of LaNiO3 layer thickness. In insulating superlattices (four unit cells or less of LaNiO3), magnetism is dominated by Ni-Mn superexchange, while itinerant electron-based Mn-Mn double exchange plays a role in thicker metallic superlattices. X-ray magnetic circular dichroism and resonant x-ray scattering show that Ni-Mn superexchange contributes to the magnetization even in metallic superlattices. This Ni-Mn superexchange interaction can be explained in terms of polar compensation at the LaNiO3-CaMnO3 interface. These results highlight the different mechanisms responsible for interfacial ferromagnetism and the importance of understanding compensation due to polar mismatch at oxide-based interfaces when engineering magnetic properties.