  In this paper we study the following mean field type equation
\begin{equation*} (MF) \qquad -\D_g u \, = \varrho ( \frac{K e^{u}}{\int_{\Sig}
K e^{u} dV_g} \, - \, 1) \, \mbox{ in } \Sigma, \end{equation*} where $(\Sigma,
g)$ is a closed oriented surface of unit volume $Vol_g(\Sigma)$ = 1, $K$
positive smooth function and $\varrho= 8 \pi m$, $ m \in \N$.
  Building on the critical points at infinity approach initiated in
\cite{ABL17} we develop, under generic condition on the function $K$ and the
metric $g$, a full Morse theory by proving Morse inequalities relating the
Morse indices of the critical points, the indices of the critical points at
infinity, and the Betti numbers of the space of formal barycenters
$B_m(\Sigma)$.\\ We derive from these \emph{Morse inequalities at infinity}
various new existence as well as multiplicity results of the mean field
equation in the resonant case, i.e. $\varrho \in 8 \pi \N$.
