  The pion-pole contribution to hadronic light-by-light scattering in the
anomalous magnetic moment of the muon $(g-2)_\mu$ is fully determined by the
doubly-virtual pion transition form factor. Although this crucial input
quantity is, in principle, directly accessible in experiment, a complete
measurement covering all kinematic regions relevant for $(g-2)_\mu$ is not
realistic in the foreseeable future. Here, we report in detail on a
reconstruction from available data, both space- and time-like, using a
dispersive representation that accounts for all the low-lying singularities,
reproduces the correct high- and low-energy limits, and proves convenient for
the evaluation of the $(g-2)_\mu$ loop integral. We concentrate on the
systematics of the fit to $e^+e^-\to 3\pi$ data, which are key in constraining
the isoscalar dependence, as well as the matching to the asymptotic limits. In
particular, we provide a detailed account of the pion transition form factor at
low energies in the time- and space-like region, including the error estimates
underlying our final result for the pion-pole contribution,
$a_\mu^{\pi^0\text{-pole}}=62.6^{+3.0}_{-2.5}\times 10^{-11}$, and demonstrate
how forthcoming singly-virtual measurements will further reduce its
uncertainty.
