In $\Delta ABC$, we have
$\begin{array}{rcl}
\tan \theta & = & \dfrac{BD}{AB} \\
\tan \theta & = & \dfrac{BD}{\ell} \\
BD & = & \ell \tan \theta
\end{array}$
Also, we have
$\begin{array}{rcl}
\angle ADB & = & 180^\circ – \angle ABD – \angle BAD \\
& = & 180^\circ – 90^\circ – \theta \\
& = & 90^\circ – \theta
\end{array}$
Since $\angle ADB = \angle BCD = 90^\circ$, then $\angle ADB + \angle BCD = 180^\circ$. Hence, we have $AD//BC$. Therefore, we have
$\begin{array}{rcl}
\angle CBD & = & \angle ADB \\
& = & 90^\circ – \theta
\end{array}$
In $\Delta BCD$,
$\begin{array}{rcl}
\sin \angle CBD & = & \dfrac{CD}{BD} \\
\sin (90^\circ-\theta) & = & \dfrac{CD}{\ell \tan\theta} \\
\cos \theta & = & \dfrac{CD}{\ell \tan\theta} \\
CD & = & \ell \tan \theta \cos \theta \\
CD & = & \ell \times \dfrac{\sin \theta}{\cos \theta} \times \cos \theta \\
CD & = & \ell \sin \theta
\end{array}$