Example 4 Let $x, y \in \mathbf{R}$. Given
$$
\left(\sqrt{x^{2}+1}-x+1\right)\left(\sqrt{y^{2}+1}-y+1\right)=2 \text{. }
$$
Find the value of $xy$.
Solve equation (1)
$$
\begin{array}{l}
\Leftrightarrow \sqrt{x^{2}+1}-x+1=\frac{2}{\sqrt{y^{2}+1}-y+1} \\
\Leftrightarrow \sqrt{x^{2}+1}-x+1=\frac{\sqrt{y^{2}+1}+y-1}{y} \\
\Rightarrow \sqrt{x^{2}+1}-x+1=\sqrt{\left(\frac{1}{y}\right)^{2}+1}-\frac{1}{y}+1 .
\end{array}
$$

Let $f(x)=\sqrt{x^{2}+1}-x+1$.
Since $f^{\prime}(x)=\frac{x}{\sqrt{x^{2}+1}}-1<0$, we know that $f(x)$ is a monotonically decreasing function.
Thus, $f(x)=f\left(\frac{1}{y}\right) \Rightarrow x=\frac{1}{y} \Rightarrow x y=1$.
[Note] This problem can also be solved using trigonometric substitution, by setting
$$
x=\tan \theta, y=\tan \varphi\left(-\frac{\pi}{2}<\theta, \varphi<\frac{\pi}{2}\right) .
$$