  [Abridged] We analyze the evolution of superhorizon-scale magnetic fields
from the end of inflation till today. Whatever is the mechanism responsible for
their generation during inflation, we find that a given magnetic mode with
wavenumber $k$ evolves, after inflation, according to the values of $k\eta_e$,
$n_{\mathbf{k}}$, and $\Omega_k$, where $\eta_e$ is the conformal time at the
end of inflation, $n_{\mathbf{k}}$ is the number density spectrum of
inflation-produced photons, and $\Omega_k$ is the phase difference between the
two Bogolubov coefficients which characterize the state of that mode at the end
of inflation. For any realistic inflationary magnetogenesis scenario, we find
that $n_{\mathbf{k}}^{-1} \ll |k\eta_e| \ll 1$, and three evolutionary
scenarios are possible: ($i$) $|\Omega_k \mp \pi| = \mathcal{O}(1)$, in which
case the evolution of the magnetic spectrum $B_k(\eta)$ is adiabatic,
$a^2B_k(\eta) = \mbox{const}$, with $a$ being the expansion parameter; ($ii$)
$|\Omega_k \mp \pi| \ll |k\eta_e|$, in which case the evolution is
superadiabatic, $a^2B_k(\eta) \propto \eta$; ($iii$) $|k\eta_e| \ll |\Omega_k
\mp \pi| \ll 1$ or $|k\eta_e| \sim |\Omega_k \mp \pi| \ll 1$, in which case an
early phase of adiabatic evolution is followed, after a time $\eta_\star \sim
|\Omega_k \mp \pi|/k$, by a superadiabatic evolution. Once a given mode
reenters the horizon, it remains frozen into the plasma and then evolves
adiabatically till today. As a corollary of our results, we find that
inflation-generated magnetic fields evolve adiabatically on all scales and for
all times in conformal-invariant free Maxwell theory, while they evolve
superadiabatically after inflation on superhorizon scales in the
non-conformal-invariant Ratra model. The latter result supports our recent
claim that the Ratra model can account for the presence of cosmic magnetic
fields.
