[proofplan]
We realize $\mathbb{C}\mathbb{P}^n$ as the quotient of $\mathbb{C}^{n+1} \setminus \{0\}$ by nonzero complex scalar multiplication. The quotient projection is restricted to the unit sphere $S^{2n+1} \subset \mathbb{C}^{n+1}$, and this restriction is continuous because it is the composition of the sphere inclusion with the quotient map. It is surjective because every nonzero vector can be normalized to have unit norm without changing its projective equivalence class. Since the unit sphere is compact and a [continuous image of a compact space is compact](/theorems/305), $\mathbb{C}\mathbb{P}^n$ is compact.
[/proofplan]
[step:Restrict the quotient projection to the unit sphere]
Fix an integer $n \geq 0$. Equip $\mathbb{C}^{n+1}$ with the Euclidean norm
\begin{align*}
|z| = \left(\sum_{j=0}^{n} |z_j|^2\right)^{1/2}
\end{align*}
for $z = (z_0,\ldots,z_n) \in \mathbb{C}^{n+1}$. Define the unit sphere
\begin{align*}
S^{2n+1} := \{z \in \mathbb{C}^{n+1} : |z| = 1\}.
\end{align*}
Let
\begin{align*}
q: \mathbb{C}^{n+1} \setminus \{0\} \to \mathbb{C}\mathbb{P}^n, \qquad z \mapsto [z]
\end{align*}
be the quotient map for the relation $z \sim w$ if and only if $w = \lambda z$ for some $\lambda \in \mathbb{C}^\times$. Let
\begin{align*}
i: S^{2n+1} \to \mathbb{C}^{n+1} \setminus \{0\}, \qquad u \mapsto u
\end{align*}
be the inclusion map. Define
\begin{align*}
\rho: S^{2n+1} \to \mathbb{C}\mathbb{P}^n, \qquad u \mapsto [u]
\end{align*}
by $\rho = q \circ i$.
The inclusion $i$ is continuous for the [subspace topology](/page/Subspace%20Topology) on $S^{2n+1}$, and the quotient map $q$ is continuous by the definition of the [quotient topology](/page/Quotient%20Topology) on $\mathbb{C}\mathbb{P}^n$. Therefore $\rho = q \circ i$ is continuous.
[/step]
[step:Show every projective point has a unit representative]
We prove that $\rho$ is surjective. Let $p \in \mathbb{C}\mathbb{P}^n$. By the definition of the quotient set, there exists $z = (z_0,\ldots,z_n) \in \mathbb{C}^{n+1} \setminus \{0\}$ such that $p = [z]$. Define
\begin{align*}
r := |z| = \left(\sum_{j=0}^{n} |z_j|^2\right)^{1/2}.
\end{align*}
Since $z \neq 0$, at least one coordinate $z_j$ is nonzero, hence $r > 0$. Define
\begin{align*}
u := r^{-1}z \in \mathbb{C}^{n+1}.
\end{align*}
Then
\begin{align*}
|u| = |r^{-1}z| = r^{-1}|z| = 1,
\end{align*}
so $u \in S^{2n+1}$. Moreover $u = r^{-1}z$ with $r^{-1} \in \mathbb{C}^\times$, so $u \sim z$ and therefore $[u] = [z]$. Thus
\begin{align*}
\rho(u) = [u] = [z] = p.
\end{align*}
Since $p$ was arbitrary, $\rho$ is surjective.
[guided]
The point of this step is to show that the sphere contains at least one representative of every projective equivalence class. Let $p \in \mathbb{C}\mathbb{P}^n$. Because $\mathbb{C}\mathbb{P}^n$ is the quotient of $\mathbb{C}^{n+1} \setminus \{0\}$, the point $p$ has the form $p = [z]$ for some nonzero vector
\begin{align*}
z = (z_0,\ldots,z_n) \in \mathbb{C}^{n+1} \setminus \{0\}.
\end{align*}
Define the Euclidean length of this representative by
\begin{align*}
r := |z| = \left(\sum_{j=0}^{n} |z_j|^2\right)^{1/2}.
\end{align*}
Because $z \neq 0$, at least one coordinate $z_j$ is nonzero. Hence the sum $\sum_{j=0}^{n} |z_j|^2$ is positive, so $r > 0$. This matters because we want to divide by $r$.
Now define
\begin{align*}
u := r^{-1}z.
\end{align*}
This vector lies on the unit sphere because
\begin{align*}
|u| = |r^{-1}z| = r^{-1}|z| = r^{-1}r = 1.
\end{align*}
Thus $u \in S^{2n+1}$. At the same time, passing from $z$ to $u$ only multiplies $z$ by the nonzero complex scalar $r^{-1} \in \mathbb{C}^\times$. Therefore $u \sim z$ under the projective [equivalence relation](/page/Equivalence%20Relation), so the two vectors determine the same point of [projective space](/page/Projective%20Space):
\begin{align*}
[u] = [z].
\end{align*}
Consequently
\begin{align*}
\rho(u) = [u] = [z] = p.
\end{align*}
Since every point $p \in \mathbb{C}\mathbb{P}^n$ is hit by some $u \in S^{2n+1}$, the map $\rho: S^{2n+1} \to \mathbb{C}\mathbb{P}^n$ is surjective.
[/guided]
[/step]
[step:Pass compactness through the continuous surjection]
The unit sphere $S^{2n+1}$ is compact by the finite-dimensional [Heine-Borel theorem](/theorems/309), since it is a closed and bounded subset of the finite-dimensional Euclidean space $\mathbb{C}^{n+1} \cong \mathbb{R}^{2n+2}$.
We now verify directly that the continuous image of this [compact space](/page/Compact%20Space) is compact. Let $\mathcal{U}$ be an [open cover](/page/Open%20Cover) of $\mathbb{C}\mathbb{P}^n$. Since $\rho$ is continuous, the collection
\begin{align*}
\{\rho^{-1}(U) : U \in \mathcal{U}\}
\end{align*}
is an open cover of $S^{2n+1}$. Since $S^{2n+1}$ is compact, there exist finitely many sets $U_1,\ldots,U_m \in \mathcal{U}$ such that
\begin{align*}
S^{2n+1} = \rho^{-1}(U_1) \cup \cdots \cup \rho^{-1}(U_m).
\end{align*}
Because $\rho$ is surjective, every point of $\mathbb{C}\mathbb{P}^n$ is the image under $\rho$ of some point of $S^{2n+1}$. Therefore
\begin{align*}
\mathbb{C}\mathbb{P}^n = U_1 \cup \cdots \cup U_m.
\end{align*}
Thus every open cover of $\mathbb{C}\mathbb{P}^n$ has a [finite subcover](/page/Finite%20Subcover), so $\mathbb{C}\mathbb{P}^n$ is compact.
[/step]