[proofplan]
From the countable base $\mathcal{B} = \{B_1, B_2, \ldots\}$, we select one point from each nonempty basis element to form a countable set $D$. The density of $D$ then follows from the defining property of a base: every nonempty open set contains a basis element, and every basis element contains a point of $D$.
[/proofplan]
[step:Select one point from each nonempty basis element to form a countable set $D$]
Let $\mathcal{B} = \{B_1, B_2, \ldots\}$ be a countable base for $\tau$. Discard any empty members (if present) and relabel, so that every $B_n \neq \varnothing$. For each $n \in \mathbb{N}$, choose a point $x_n \in B_n$ (by the Axiom of Countable Choice applied to the countable family $\{B_n\}_{n=1}^\infty$ of nonempty sets). Define
\begin{align*}
D := \{x_n : n \in \mathbb{N}\}.
\end{align*}
Since $D$ is the image of $\mathbb{N}$ under the map $n \mapsto x_n$, the set $D$ is countable.
[guided]
The idea is to "sample" the topology. A base determines every open set via unions, so if we place at least one point inside each basis element, the resulting set will intersect every nonempty open set --- which is precisely the definition of density.
Let $\mathcal{B} = \{B_1, B_2, \ldots\}$ be a countable base for the topology $\tau$. Some basis elements might be empty (the definition of a base does not exclude $\varnothing$), so we discard those; the remaining collection is still countable and still a base (removing $\varnothing$ from a base does not affect which open sets can be written as unions of basis elements, since $\varnothing$ is the empty union).
Relabel the nonempty basis elements as $B_1, B_2, \ldots$. For each $n \in \mathbb{N}$, the set $B_n$ is nonempty, so we may choose a point $x_n \in B_n$. (This uses the Axiom of Countable Choice: we are making one selection from each member of a countable family of nonempty sets.) Define
\begin{align*}
D := \{x_n : n \in \mathbb{N}\}.
\end{align*}
The set $D$ is countable because it is indexed by $\mathbb{N}$.
[/guided]
[/step]
[step:Verify that $D$ is dense by showing every nonempty open set contains a point of $D$]
Let $G \in \tau$ be a nonempty open set. Since $\mathcal{B}$ is a base for $\tau$, there exists an index $n \in \mathbb{N}$ with $B_n \subset G$ and $B_n \neq \varnothing$. By construction, $x_n \in B_n \subset G$, so $G \cap D \neq \varnothing$.
Since every nonempty open set meets $D$, the closure $\overline{D}$ equals $X$. Therefore $D$ is a countable dense subset, and $X$ is [separable](/page/Separable%20Space).
[guided]
We must show that $\overline{D} = X$, which is equivalent to showing that every nonempty open set $G \in \tau$ intersects $D$.
Let $G \in \tau$ with $G \neq \varnothing$. Since $\mathcal{B}$ is a base for $\tau$, the set $G$ is a union of members of $\mathcal{B}$:
\begin{align*}
G = \bigcup \{B \in \mathcal{B} : B \subset G\}.
\end{align*}
Because $G \neq \varnothing$, at least one $B_n$ in this union is nonempty, so $B_n \subset G$. By our construction, $x_n \in B_n$, and therefore $x_n \in G$. Since $x_n \in D$, we conclude $G \cap D \neq \varnothing$.
This holds for every nonempty open set $G$, so $\overline{D} = X$: the set $D$ is dense. Since $D$ is countable, the space $X$ is [separable](/page/Separable%20Space).
[/guided]
[/step]