  We present a detailed analysis of $e^+e^-\to\pi^+\pi^-$ data up to
$\sqrt{s}=1\,\text{GeV}$ in the framework of dispersion relations. Starting
from a family of $\pi\pi$ $P$-wave phase shifts, as derived from a previous
Roy-equation analysis of $\pi\pi$ scattering, we write down an extended Omn\`es
representation of the pion vector form factor in terms of a few free parameters
and study to which extent the modern high-statistics data sets can be described
by the resulting fit function that follows from general principles of QCD. We
find that statistically acceptable fits do become possible as soon as potential
uncertainties in the energy calibration are taken into account, providing a
strong cross check on the internal consistency of the data sets, but preferring
a mass of the $\omega$ meson significantly lower than the current PDG average.
In addition to a complete treatment of statistical and systematic errors
propagated from the data, we perform a comprehensive analysis of the systematic
errors in the dispersive representation and derive the consequences for the
two-pion contribution to hadronic vacuum polarization. In a global fit to both
time- and space-like data sets we find $a_\mu^{\pi\pi}|_{\leq
1\,\text{GeV}}=495.0(1.5)(2.1)\times 10^{-10}$ and $a_\mu^{\pi\pi}|_{\leq
0.63\,\text{GeV}}=132.8(0.4)(1.0)\times 10^{-10}$. While the constraints are
thus most stringent for low energies, we obtain uncertainty estimates
throughout the whole energy range that should prove valuable in corroborating
the corresponding contribution to the anomalous magnetic moment of the muon. As
side products, we obtain improved constraints on the $\pi\pi$ $P$-wave,
valuable input for future global analyses of low-energy $\pi\pi$ scattering, as
well as a determination of the pion charge radius, $\langle r_\pi^2 \rangle =
0.429(1)(4)\,\text{fm}^2$.
