[proofplan]
The proof uses the defining closed and open sets of the [cofinite topology](/page/Cofinite%20Topology). If $A$ is finite, then its complement is open, so $A$ is closed and therefore equals its closure. If $A$ is infinite, every nonempty [open set](/page/Open%20Set) has finite complement, so no open neighbourhood can avoid $A$; the neighbourhood characterization of closure then puts every point of $X$ in $\overline{A}$.
[/proofplan]
[step:Show that every finite subset is closed and equals its closure]
Assume that $A\subset X$ is finite. Since $X\setminus A$ has complement $A$ in $X$, and $A$ is finite, the definition of $\tau_{\mathrm{cof}}$ gives
\begin{align*}
X\setminus A\in \tau_{\mathrm{cof}}.
\end{align*}
Thus $A$ is closed in $(X,\tau_{\mathrm{cof}})$.
By the definition of closure, $\overline{A}$ is the smallest closed subset of $X$ containing $A$, equivalently the intersection of all closed subsets of $X$ that contain $A$. Since $A$ itself is a closed subset of $X$ containing $A$, we have $\overline{A}\subset A$. The reverse inclusion $A\subset \overline{A}$ holds for every subset of a [topological space](/page/Topological%20Space). Therefore
\begin{align*}
\overline{A}=A.
\end{align*}
[/step]
[step:Show that every infinite subset meets every nonempty open set]
Assume that $A\subset X$ is infinite. Let $U\subset X$ be a nonempty open set in $\tau_{\mathrm{cof}}$. Since $U\neq\varnothing$, the definition of the cofinite topology implies that $X\setminus U$ is finite.
Suppose, for contradiction, that $A\cap U=\varnothing$. Then every point of $A$ lies in $X\setminus U$, so
\begin{align*}
A\subset X\setminus U.
\end{align*}
Since $X\setminus U$ is finite, this would make $A$ finite, contradicting the assumption that $A$ is infinite. Hence
\begin{align*}
A\cap U\neq\varnothing.
\end{align*}
[guided]
We want to prove that an infinite subset $A$ cannot be avoided by a nonempty open set. Let $U\subset X$ be nonempty and open in the cofinite topology. The word “nonempty” matters because the empty set is also open in the cofinite topology, but it need not meet $A$.
Since $U$ is a nonempty open set, it is not the exceptional open set $\varnothing$. Therefore, by the defining property of the cofinite topology, its complement $X\setminus U$ is finite.
Now suppose that $U$ failed to meet $A$. This means
\begin{align*}
A\cap U=\varnothing.
\end{align*}
Equivalently, no point of $A$ lies in $U$, so every point of $A$ lies in the complement $X\setminus U$. Thus
\begin{align*}
A\subset X\setminus U.
\end{align*}
But $X\setminus U$ is finite, and every subset of a finite set is finite. This would imply that $A$ is finite, contradicting the hypothesis that $A$ is infinite. Therefore the supposition was impossible, and we conclude that
\begin{align*}
A\cap U\neq\varnothing.
\end{align*}
[/guided]
[/step]
[step:Use the neighbourhood characterization of closure to identify the closure]
Assume again that $A\subset X$ is infinite. Let $x\in X$ be arbitrary, and let $U\subset X$ be any open neighbourhood of $x$ in $(X,\tau_{\mathrm{cof}})$. Since $x\in U$, the set $U$ is nonempty. By the preceding step,
\begin{align*}
A\cap U\neq\varnothing.
\end{align*}
Thus every open neighbourhood of $x$ intersects $A$. By the neighbourhood characterization of closure, this means $x\in \overline{A}$.
Since $x\in X$ was arbitrary, we have $X\subset \overline{A}$. The reverse inclusion $\overline{A}\subset X$ holds because $\overline{A}$ is a subset of the ambient space $X$. Therefore
\begin{align*}
\overline{A}=X.
\end{align*}
This proves the stated dichotomy.
[/step]