The following theorem is due to David Hilbert:
> Let $K/\mathbf Q$ be a cyclic Galois extension, with Galois group generated by $\sigma$. Then every element of norm $1$ of $K$ is of the form $\sigma(x)/x$ for some $x \in K^\times$.
Applying this to $K=\mathbf Q(\sqrt D)$ and noticing that $N(x+\sqrt D y) = x^2-Dy^2$, it follows that every solution to $N(x+\sqrt D y) = 1$ is of the form
$$x+\sqrt Dy = \frac{u - \sqrt D v}{u + \sqrt D v} = \frac{u^2+Dv^2}{u^2-Dv^2} + \sqrt D \frac{-2uv}{u^2-Dv^2},$$
i.e.
$$(x,y) = \left(\frac{u^2+Dv^2}{u^2-Dv^2}, \frac{-2uv}{u^2-Dv^2}\right), \qquad (u, v) \in \mathbf Q,\qquad u^2+v^2 \
eq 0.$$