  Line-intensity mapping (LIM) provides a promising way to probe cosmology,
reionization and galaxy evolution. However, its sensitivity to cosmology and
astrophysics at the same time is also a nuisance. Here we develop a
comprehensive framework for modelling the LIM power spectrum, which includes
redshift space distortions and the Alcock-Paczynski effect. We then identify
and isolate degeneracies with astrophysics so that they can be marginalized
over. We study the gains of using the multipole expansion of the anisotropic
power spectrum, providing an accurate analytic expression for their covariance,
and find a 10%-60% increase in the precision of the baryon acoustic oscillation
scale measurements when including the hexadecapole in the analysis. We discuss
different observational strategies when targeting other cosmological
parameters, such as the sum of neutrino masses or primordial non-Gaussianity,
finding that fewer and wider bins are typically more optimal. Overall, our
formalism facilitates an optimal extraction of cosmological constraints robust
to astrophysics.
