The $\sim 5\sigma$ mismatch between the value of the Hubble parameter measured by SH0ES and the one inferred from the inverse distance ladder (IDL) constitutes the biggest tension afflicting the standard model of cosmology, which could be pointing to the need of physics beyond $\Lambda$CDM. In this paper we study the background history required to solve the $H_0$ tension if we consider standard prerecombination physics, paying special attention to the role played by the data on baryon acoustic oscillations (BAO) employed to build the IDL. We show that the anisotropic BAO data favor an ultra-late-time (phantom-like) enhancement of $H(z)$ at $z\lesssim 0.2$, accompanied by a transition in the absolute magnitude of supernovae of Type Ia $M(z)$ in the same redshift range. This agrees with previous findings in the literature. The effective dark energy (DE) density must be smaller than in the standard model at higher redshifts. Instead, when angular BAO data (claimed to be less subject to model dependencies) is employed in the analysis, we find that the increase of $H(z)$ starts at much higher redshifts, typically in the range $z\sim 0.5-0.8$. In this case, $M(z)$ could experience also a transition (although much smoother) and the effective DE density becomes negative at $z\gtrsim 2$. Both scenarios require a violation of the weak energy condition (WEC), but leave an imprint on completely different redshift ranges and might also have a different impact on the perturbed observables. They allow for the effective crossing of the phantom divide. Finally, we employ two alternative methods to show that current data from cosmic chronometers do not exclude the violation of the WEC, but do not add any strong evidence in its favor neither. Our work puts the accent on the utmost importance of the choice of the BAO data set in the study of the possible solutions to the $H_0$ tension.
Comment: 24 pages, 16 figures, 4 tables. Version accepted for publication in Phys. Rev. D. Extended discussion (new appendices C and D), new figures, new Table IV, and references added. Typos corrected