This question has been asked here and here, though no answers have been given. It is exercise 3.2.1 in Smith's Invitation.
Showing $\mathbb{P}^n$ is compact boils down to showing it is the continuous image (under the projection map) of the (compact Euclidean) unit sphere in $\mathbb{C}^{n+1}\setminus \{0\}$, and then (as in a comment in the second post) projective varieties as a closed subspace of $\mathbb{P}^n$ (closed in Zariski topology, hence closed in Euclidean topology) is also compact.
I am struggling in showing that a projective variety is the compactification of an affine variety in the Euclidean (or Zariski) topology. Intuitively it makes sense - by adding on 'points at infinity' to some affine variety, it becomes compact - but I cannot seem to make it rigorous. I have the following ideas below.
If $X$ is an affine variety, the only associated projective variety $V$ I can think of is the one for which $X$ is the affine cone over $V$, where $V$ is constructed by identifying points in $X$ which lie on the same line. However, such a map $X \to V$ is clearly not injective, and so cannot be an extension (let alone compact). Should I be looking in a different direction here?