If $i=n$, then an immersion $f \colon S^i \to M$ is a local diffeomorphism by the inverse function theorem and $f$ is a finite cover.
For $i<n$, this is a question in homotopy theory, as the Smale-Hirsch theorem tells you that the map
$$Imm(S^i,M) \to Mon(TS^i,TM)$$
sending an immersion to its derivative is a weak equivalence. Here the right side is the space of a vector bundle monomorphisms. Taking the map underlying a vector bundle monomorphism gives a map
$$Mon(TS^i,TM) \to Map(S^i,M)$$
and you are asking when the homotopy fiber over a map $f \colon S^i \to M$ is non-empty. This homotopy fiber is weakly equivalent to the space of bundle maps $TS^i \to f^* TM$ which cover the identity of $S^i$. So we get an answer, in some sense: the tangent bundle $TS^i$ should be a summand of $f^* TM$. It may be hard in practice to see whether this is possible, but it is the type of question that the tools of homotopy theory were designed for.
You can, however, find some easy sufficient criteria. For example, if $M$ is parallellizable: $TS^i$ is a summand of the trivial bundle $\epsilon^{i+1}$ and this is a summand of $f^* TM = \epsilon^n$. More concretely, since oriented $3$-manifolds are parallellizable, every homotopy class of maps $S^2 \to M$ is represented by an immersion.