I think you are reading the wrong part of your book. That definition (top of p. 185 in my edition) is immediately preceded by a Theorem 29.1, which is a long explanation of how one can take a noncompact locally-compact Hausdorff space $X$ and embed it into a compact space $\def\Y{X^\ast}\Y$ that has exactly one point more than $X$. This larger space $\Y$ is the one-point compactification of a space $X$, sometimes called the Alexandroff compactification of $X$.
The one-point compactification
$\Y$ consists of $X\cup \{\infty\}$, where $\infty$ is some new point that is not an element of $X$. The topology is as follows:
- If $G$ is an open subset of $X$, then $G$ is also an open set of $\Y$
- If $C$ is a compact subset of $X$, then $\{\infty\}\cup(X\setminus C)$ is an open set of $\Y$
Theorem 29.1 shows that if $X$ is a Hausdorff space that is locally compact but not compact, then $\Y$, with the topology described above, is a compact Hausdorff space of which $X$ is a subspace. Theorem 29.1 also shows that any one-point compactification of $X$ must be homeomorphic to the $\Y$ described above, so that the one-point compactification of $X$ is essentially unique. This is the construction Munkres wants you to consider.
This construction is the topological formalization of the idea of taking an infinite space $X$ and "adding a point at infinity". We do this, for example, with the complex numbers, to obtain the Riemann sphere. (Ignore this example if you don't know about the Riemann sphere.) A simpler example is that the one-point compactification of $\Bbb R$ is (homeomorphic to) $S^1$, the circle: the two ends at infinity are brought together and joined at the new point $\infty$.
I hope the question makes more sense in this light.
A word of advice: In some subjects, and on standardized tests, you can read the question first, then go back and skim the material looking for something pertinent, and then answer the question without reading all the material. In advanced mathematics, this strategy will not work. You have to adopt a different strategy. First read over the entire chapter, very slowly, taking time to understand and digest each sentence before you move on to the next one. This may take several days, or more. Then do the exercises.
Consider the map$$\begin{array}{rccc}s\colon&\mathbb R&\longrightarrow&S^1\\&x&\mapsto&\left(\dfrac{1-x^2}{1+x^2},\dfrac{2x}{1+x^2}\right).\end{array}$$Then $s$ is a homeomorphism between $\mathbb R$ and $S^1\setminus\bigl\{(-1,0)\bigr\}$. So, since $S^1\setminus\bigl\{(-1,0)\bigr\}$ is dense in $S^1$ and $S^1\setminus\left(S^1\setminus\bigl\{(-1,0)\bigr\}\right)$ consists of a single point, $S^1$ is the one-point compactification of $\mathbb R$. More generally, if $\theta\in\mathbb R$, then$$\begin{array}{rccc}s_\theta\colon&\mathbb R&\longrightarrow&S^1\\&x&\mapsto&\begin{bmatrix}\cos\theta&-\sin\theta\\\sin\theta&\cos\theta\end{bmatrix}.\left(\dfrac{1-x^2}{1+x^2},\dfrac{2x}{1+x^2}\right)\end{array}$$is a homeomorphism between $\mathbb R$ and $S^1\setminus\bigl\{(-\cos\theta,-\sin\theta)\bigr\}$.
A similar argument applies to $\mathbb R^2$ and $S^2$. Just consider the map:$$\begin{array}{rccc}\psi\colon&\mathbb R^2&\longrightarrow&S^2\\&(x,y) &\mapsto&\left(\frac{2x}{x^2+y^2+1},\frac{2y}{x^2+y^2+1},\frac{x^2+y^2-1}{x^2+y^2+1}\right).\end{array}$$
It is a homeomorphism between $\mathbb R^2$ and $S^2\setminus\{(0,0,1)\}$.
Best Answer
For any space $X$ we can construct a space $\alpha(X)$, the Aleksandrov extension of $X$ by defining a space $Y$ as Munkres does with the extra provision that we take all complements of closed compact subsets of $X$ as the extra neighbourhoods for $\infty$. One can easily check that $\alpha(X)$ is then compact.
The "closed" is needed in general because if e.g. $X$ is not Hausdorff it could have some compact subset $K$ which is not closed, and then (if we were to omit the closed condition) $(X\setminus K) \cup \{\infty\}$ would be open while its intersection with $X$ would be $X\setminus K$, which was not open, so if we left out the closed condition $X$ would not have the same topology as a subspace of $\alpha(X)$ as originally, going against the idea of an extension/compactification: we want to embed $X$ in a larger space with better properties, so in the larger space it should be a subspace with the same topology that it had originally.
If we want $Y = \alpha(X)$ to be Hausdorff, (so in particular $X$ should then be Hausdorff, as a subspace of $Y$) we need to be able to separate $\infty$ from every point $x$ in $X$. As a neighbourhood of $\infty$ is of the form $\{\infty\} \cup X \setminus C$, with $C$ compact and closed, every point $x$ should then have a neighbourhood that sits inside a compact closed set, i.e. $X$ must be locally compact.
So $\alpha(X)$ can always be defined such that $\alpha(X)\setminus X$ is a point and $X$ is a subspace of $\alpha(X)$ and it is always compact (regardless of $X$) but $\alpha(X)$ is Hausdorff iff $X$ is locally compact and Hausdorff. A special case is when $X$ is already Hausdorff and compact, in which case we add an isolated point $\infty$ (as $X$ can be taken as $C$, a compact closed subset) and we get that $X$ is not dense in $\alpha(X)$.
Normally we only consider Hausdorff compactifications and in that case the local compactness is needed for the Hausdorffness of the construction $\alpha(X)$. And also because then $X$ is an open subset of a compact Hausdorff space and thus locally compact for that reason.