Example 9 Given the sequence $\left\{a_{n}\right\}$ with the sum of the first $n$ terms $S_{n}=$ $n^{2}$. Then
$$
\begin{array}{l}
\frac{1}{\sqrt{a_{1}}+\sqrt{a_{2}}}+\frac{1}{\sqrt{a_{2}}+\sqrt{a_{3}}}+\cdots \\
+\frac{1}{\sqrt{a_{998}}+\sqrt{a_{999}}}=(\quad) .
\end{array}
$$
(A) $\frac{\sqrt{1996}-1}{2}$
(B) $\frac{\sqrt{1997}-1}{2}$
(C) $\frac{\sqrt{1998}-1}{2}$
(D) $\frac{\sqrt{1999}-1}{2}$
$$
\begin{array}{l}
\text { Solution: Original expression }=\frac{1}{2}\left[\left(\sqrt{a_{2}}-\sqrt{a_{1}}\right)+\left(\sqrt{a_{3}}\right.\right. \\
\left.-\sqrt{a_{2}}\right)+\cdots+\left(\sqrt{a_{999}}\right. \\
\left.\left.-\sqrt{a_{998}}\right)\right] \\
=\frac{1}{2}\left(\sqrt{a_{999}}-\sqrt{a_{1}}\right) \\
=\frac{1}{2}(\sqrt{1+(999-1) \times 2}-1) \\
=\frac{\sqrt{1997}-1}{2} \text {. } \\
\end{array}
$$

Therefore, the correct choice is (B).
$$