  We present the first multi-wavelength study of Mrk 501 including
very-high-energy (VHE) gamma-ray observations simultaneous to X-ray
polarization measurements from the Imaging X-ray Polarimetry Explorer (IXPE).
We use radio-to-VHE data from a multi-wavelength campaign organized between
2022-03-01 and 2022-07-19. The observations were performed by MAGIC, Fermi-LAT,
NuSTAR, Swift (XRT and UVOT), and several instruments covering the optical and
radio bands. During the IXPE pointings, the VHE state is close to the average
behavior with a 0.2-1 TeV flux of 20%-50% the emission of the Crab Nebula.
Despite the average VHE activity, an extreme X-ray behavior is measured for the
first two IXPE pointings in March 2022 with a synchrotron peak frequency >1
keV. For the third IXPE pointing in July 2022, the synchrotron peak shifts
towards lower energies and the optical/X-ray polarization degrees drop. The
X-ray polarization is systematically higher than at lower energies, suggesting
an energy-stratification of the jet. While during the IXPE epochs the
polarization angle in the X-ray, optical and radio bands align well, we find a
clear discrepancy in the optical and radio polarization angles in the middle of
the campaign. We model the broad-band spectra simultaneous to the IXPE
pointings assuming a compact zone dominating in the X-rays and VHE, and an
extended zone stretching further downstream the jet dominating the emission at
lower energies. NuSTAR data allow us to precisely constrain the synchrotron
peak and therefore the underlying electron distribution. The change between the
different states observed in the three IXPE pointings can be explained by a
change of magnetization and/or emission region size, which directly connects
the shift of the synchrotron peak to lower energies with the drop in
polarization degree.
