This is just the special case of Pete’s answer that you need for your problem, with a few more details.
There are countably many rationals, so there are countably many open intervals with rational endpoints; list them as $\{I_n:n\in\mathbb{N}\}$. Let $X$ be any subset of $\mathbb{R}$. For each $n\in\mathbb{N}$ there are two possibilities:
- $I_n\cap X=\varnothing$: In this case do nothing.
- $I_n\cap X\ne\varnothing$: Let $x_n$ be any point of $I_n\cap X$.
Now let $D=\{x_n:I_n\cap X\ne\varnothing\}$. Clearly $D$ is countable, and I claim that $D$ is a dense subset of $X$, i.e., such that $X=\operatorname{cl}_X D$.
To see this, let $x$ be any point of $X$, and let $(x-\epsilon,x+\epsilon)$ be an open interval centred at $x$. The rationals are dense in $\mathbb{R}$, so there are rationals $p\in(x-\epsilon,x)$ and $q\in(x,x+\epsilon)$. Then $(p,q)$ is an open interval with rational endpoints, so $(p,q)=I_n$ for some $n\in\mathbb{N}$. Moreover, $x\in I_n\cap X$, so $I_n\cap X\ne\varnothing$, and according to $(2)$ above there is a point $x_n\in D\cap I_n$. But $I_n\subseteq(x-\epsilon,x+\epsilon)$, so $x_n\in (x-\epsilon,x+\epsilon)\cap D$. In other words, for each $\epsilon>0$ the $\epsilon$-nbhd of $x$ contains a point of $D$, and therefore $x\in\operatorname{cl}_X D$, as desired.
To connect this with second countability: the family $\{I_n:n\in\mathbb{N}\}$ is a countable base for the Euclidean topology of $\mathbb{R}$. A base for the topology is just a collection $\mathscr{B}$ of open sets such that every open set is a union of some subcollection of $\mathscr{B}$; a space is second countable if its topology has a countable base. If $X$ is any subset of $\mathbb{R}$, $\{X\cap I_n:n\in\mathbb{N}\}$ is a countable base for the subspace topology on $X$, so second countability is hereditary: if a space is second countable, so are all of its subspaces. And the trick that I used above can pretty clearly be applied to any second countable space to get a countable dense subset $-$ which is why every second countable space is separable, and even hereditarily separable.