Adding a faster approach than the accepted answer since this post is the first result returned by Google.
For $U := \left(\begin{smallmatrix}a&b\\c&d\end{smallmatrix}\right)$ with $a,b,c,d\in\mathbb{C}$, we instead compare the matrix entries in the defining unitary equation $U^* = U^{-1}$.
Equating $U^{-1} = \frac{1}{\det U} \left(\begin{smallmatrix}d&-b\\-c&a\end{smallmatrix}\right)$ with the adjoint (conjugate ($\overline{a}$) transpose) of $U$ entrywise yields
$$d = \overline{a} \cdot \det U,\ \ a = \overline{d} \cdot \det U,\ \ \text{and}\ \ -b = \overline{c} \cdot \det U.\quad \quad \quad (1)$$
The first two equations give $d = d \cdot \overline{\det U} \cdot \det U = d \cdot \|\det U\|^2$ so for $d\neq 0$ this forces $\|\det U\|^2=1$, thus the scaling factor is $\det U = e^{i\theta}$. As $\det U\in\mathbb{C}$, this is true because for any complex number $z\in\mathbb{C}$, having unit modulus $\|z\|=1$ implies $z$ is on the unit circle, and so $z$ is determined by the angle $\theta$ such that $z=e^{i\theta}$. [Alternatively and more simply, use $\det\left(U U^\dagger\right)=1$ as suggested by @Icv.]
Now substituting $\det U = e^{i\theta}$ back into $(1)$ yields
$$c = -e^{i\theta} \overline{b}\ \ \text{and}\ \ d = e^{i\theta} \overline{a},$$
hence $$ U = \begin{pmatrix}
a & b\\
-e^{i\theta} \overline{b} & e^{i\theta} \overline{a}
\end{pmatrix}. $$
$\rule{19cm}{0.4pt}$
Zero-division technicality: We can't have both $d$ and $c$ equal to $0$ for $U$ unitary as this would give singular determinant $\det U = ad-bc = 0$. We know this because assuming otherwise leads to a contradiction: by definition of $U$ being unitary, we know that $U^{-1}=U^*$ exists, so in particular $U$ is invertible and in turn $\det U \neq 0$... contradiction. Thus if $d=0$ occurs, for $U$ unitary we know that $c \neq 0$, so we can argue just as we did but instead deriving $\|\det U\|=1$ using $-c = \overline{b} \cdot \det U$ and $-b = \overline{c} \cdot \det U$, rather than the first two equations of Eq. $(1)$.