  We present a framework and an open-source python toolkit to analyse the
2-point statistics of 3D fluctuations in the context of HI intensity maps using
the multipole expansion formalism. We include simulations of the cosmological
HI signal using N-body and log-normal methods, foregrounds and their removal,
as well as instrumental effects. Using these simulations and analytical
modelling, we investigate the impact of foreground cleaning and the
instrumental beam on the power spectrum multipoles as well as on the Fourier
space clustering wedges. We find that both the instrumental beam and the
foreground removal can produce a quadrupole (and a hexadecapole) signal, and
demonstrate the importance of controlling and accurately modelling these
effects for precision radio cosmology. We conclude that these effects can be
modelled with reasonable accuracy using our multipole expansion technique. We
also perform an MCMC analysis to showcase the effect of foreground cleaning on
the estimation of the HI abundance and bias parameters. The accompanying python
toolkit is available at https://github.com/IntensityTools/MultipoleExpansion,
and includes an interactive suite of examples to aid new users.
