Prove that if $S$ is a subset of $R$, then $\bar{S}$ is a closed set. Lemma 3.21. 
Let $S$ be a subset of $R$. Then $\bar{S}$ is a closed set. $\bar{S}$ denotes the closure of $S$.
The following is a proof of Lemma 3.21:
Proof. 

By Corollary 3.16 it is enough to show that $\bar{S^c}$
  is open.

I understand that if we show that $\bar{S^c}$ is open, then $\bar{S}$ is closed, since Corollary 3.16 states that "a nonempty set $E$ is closed iff $E^c$
is open."

We will show that
  $\bar{S^c}$
  is open using Lemma 3.15 (c) with $S$ replaced by $\bar{S^c}$
  . So let $x \in \bar{S^c}$, if we can
  show that $x$ has a neighborhood $U$ which is contained in $\bar{S^c}$
  then we will be done (by that Lemma).

Lemma 3.15 (c) states that "for every point $x \in S$, there exists $\epsilon > 0$ s.t. $N(x,\epsilon) ⊂ S$." So, I see why we replace $S$ with $\bar{S^c}$. Lemma 3.15 (a) states that "$S$ is open" and Lemma 3.15 (a) and (c) are equivalent. So, essentially, we would show that $\bar{S^c}$ is open.

By the contrapositive of Lemma 3.20, there is a neighborhood $N$ of $x$ which is contained in $\bar{S^c}$.

I understand that this is the contrapositive of Lemma 3.20. Lemma 3.20 states that "if $S$ is a nonempty set of real numbers then $x \in \bar{S}$ iff every neighborhood of $x$ contains at least one point $\in S$."

If $y \in U$, then since $N$ is open, by the contrapositive of the last assertion in Lemma 3.20 with $x$ replaced by $y$, we see that $y \notin \bar{S}$. 

I understand how we arrive at the contrapositive of the statement. But, why do we replace $x$ with $y$? And is $N$ referring to an arbitrary neighborhood from Lemma 3.20?

So $N ⊂ \bar{S^c}$
  . Hence by Lemma 3.15 (c), $U = \bar{S^c}$
  is open.

Since the contrapositive states that $y \notin \bar{S}$, I get why $y \in \bar{S^c}$. But, I don't follow why $N ⊂ \bar{S^c}$ and why $U = \bar{S^c}$.
 A: I think the argument is the following: $x\in \overline{S}^c
\Leftrightarrow x\not\in\overline{S}\Leftrightarrow$ there exists a neighborhood $N$ of $x$ such that $N\subset S^c$. If $y\in N$ one cannot have $y\in \overline{S}$ because $N$ is a neighborhood of $y$ that contains no element of $S$. Hence $N\subset\overline{S}^c$.
We have shown that every $x\in \overline{S}^c$ has a neighborhood $N\subset\overline{S}^c$, hence $\overline{S}^c$ is open, hence $\overline{S}$ is closed.
A: Stripping away all the language  of Lemmas and terminology leaves a very simple argument which I hope you will find helpful:-
Suppose that the complement of $\bar{S}$ is not open. Then, by definition, it contains a point $x$ such that every neighborhood of $x$ contains a point of $\bar{S}$ i.e. either a point of $S$ or an accumulation point of $S$. 
If such a neighborhood, $N$, contained an accumulation point of $S$ then $N$ also contains a neighborhood of that accumulation point and so, by definition, contains a point of $S$ itself. Then $x$ is itself an accumulation point of $S$ and is therefore in $\bar{S}$, a contradiction.
