I am reading Measure Theory, Integration, and Real Analysis by Sheldon Axler. Below is the proof he supplies on page 19 of the Heine-Borel theorem:
Suppose $F$ is a closed bounded subset of $\mathbb{R}$ and $\mathcal{C}$ is an open cover of $F$. First consider the case where $F = [a,b]$ for some $a,b\in\mathbb{R}$ with $a < b$. Thus $\mathcal{C}$ is an open cover of $[a,b]$.
Let $$ D = \{d \in [a,b] : \text{$[a,d]$ has a finite subcover from $\mathcal{C}$} \}. $$ Note that $a \in D$ (because $a \in G$ for some $G \in \mathcal{C}$). Thus $D$ is not the empty set.
Let $s = \sup D$. Thus $s \in [a,b]$. Hence there exists an open set $G \in \mathcal{C}$ such that $s \in G$. Let $\delta > 0$ be such that $(s-\delta, s+\delta) \subset G$. Because $s = \sup D$, there exist $d \in (s−\delta,s]$ and $n \in \mathbb{Z}^+$ and $G_1,\ldots,G_n \in C$ such that $[a,d] ⊂ G_1 \cup \cdots \cup G_n$. Now
$$ [a,d] \subset G \cup G_1 \cup \cdots \cup G_n \qquad \text{for all} \quad d \in [s,s+ \delta). \tag{2.13} $$
Thus $d' \in D$ for all $d' \in [s,s+\delta) \cap [a,b]$. This implies that $s = b$. Furthermore, $\text{(2.13)}$ with $d = b$ shows that $[a,b]$ has a finite subcover from $\mathcal{C}$, completing the proof in the case where $F = [a,b]$.
I do not understand why
$$ d' \in D \qquad\text{for all} \quad d' \in [s,s+\delta) \cap [a,b] \tag{1} $$
implies that $s = b$. How do we know that $b$ is even in $[s,s+\delta) \cap [a,b]$? $s$ is the supremum of $D$ which we only know is nonempty because it certainly contains $a$. At first I believed that if $s$ were not $b$, then the definition of $s$ as the supremum of $D$ would be contradicted. But this does not necessarily follow; $s$ is not the supremum of $[a,b]$ itself, but the supremum of all $[a,d]$ contained in $[a,b]$ with a finite subcover in $\mathcal{C}$. Supposing this set is $\{a\}$, then $\text{(1)}$ only implies that $s$ is the supremum of $(a+\delta)$.
Suppose that $s<b$. Then there is some $d'\in(s,s+\delta)\cap[a,b]$, and we know that $[s,s+\delta)\cap[a,b]\subseteq D$, so $d'\in D$. Remember, though, that $s=\sup D$. Thus, if $x\in[a,b]$ and $x>s$, $x\notin D$; $d'\in(s,s+\delta)\cap[a,b]$, so $d'>s$ and $d'\in[a,b]$, and therefore $d'\notin D$. This contradiction was the result of assuming that $s<b$, so $s$ cannot be less than $b$. On the other hand, $s$ is the supremum of a subset of $[a,b]$, so we know that $s\le b$. The only possibility, then, is that $s=b$.