Immersion is a diffeomorphism. Clearly I suppose to put the condition $n > 1$ in use. So my proof must went wrong.. Could someone help me take a look at it? Thanks!

Suppose $X$ is a smooth, compact, connected $n$-manifold without boundary which admits an immersion to $S^n$. Show that if $n > 1$, then this immersion is a diffeomorphism.

By local immersion theorem,

Local Immersion Theorem
  Suppose that $f: X \to Y$ is an immersion at $x$, and $y = f(x)$. Then there exist local coordinates around $x$ and $y$ such that
  $$f(x_1, \dots, x_k) = (x_1, \dots, x_k, 0, \dots, 0).$$
  In other words,$x$ is locally equivalent to the canonical immersion near $x$.

Therefore, the image of $f$ is open, since $(x_1, \dots, x_k)$ is open in $X$ so $(x_1, \dots, x_k, 0, \dots, 0)$ is open in $Y$. Also, because $X$ is compact, $f$ is proper. Therefore, $f$ is an embedding. According to the theorem, $f$ is an embedding.

Theorem An embedding $f: X \to Y$ maps $X$ diffeomorphically onto a submanifold of $Y$.

However, continuous functions preserves compactness, hence the image of $f$ is closed. The only closed and open subset of $Y$ is $Y$ itself. Hence $f$ is surjective. Therefore, since $f$ maps $X$ diffeomorphically onto a submanifold of $Y$, the submanifold is $Y$. And consequently, $f$ is a diffeomorphism.
 A: What you have is in fact a "local embedding" instead of a global embedding. You need to be slightly careful since different books may use different definition of "embedding" and "immersion". But anyway, now you have an immersion $f$ which is locally a diffeomorphism 
$$M\overset{f}{\to} S^n$$
For a local embedding to fail to be a global one, you must have overlapped image, or equivalently have $f$ failing to be injective. This amounts to saying that $f$ must be a covering map of $S^n$, or equivalently $M$ is a covering space of $S^n$. This rules out the possibility of $S^1$ since its fundamental group is not trivial. Now for $n>1$, since it is well known that they have trivial fundamental group, therefore $f$ must be a 1-folded covering map, or equivalently a global embedding.
A: Acturally, it should also be noted that the dimension of $M$ plays a critical rule, since the claim $f$ is open is a consequence of the invariance of domain. The problem can be split into a few well-known results:
(1) Let $U\subset \mathbb{R}^n$, if $f:U\to f(U)\subset \mathbb{R}^n$ is a diffeomorphism, then $f(U)$ is open in $\mathbb{R}^n$.
(2) If $f:M\to N$ is a local diffeomorphism between two compact connected manifolds, then $f$ is a smooth covering map.
(3) Let $f:M\to N$ is a covering map between two manifolds. Further suppose that $N$ is simply connected, then $f$ is a diffeomorphism.
So for the problem given above, the dimension assumption guarantees that $f$ is indeed a local diffeomorphism not just a local embedding. The assumption that $n>1$ guarantees that $S^n$ is simply connected.
