Example 1 Let the function $f:\{x \mid x \neq 0,1, x \in \mathbf{R}\} \rightarrow \mathbf{R}$, and satisfies $f(x)+f\left(\frac{x-1}{x}\right)=1+x$, find $f(2)$.
Let $\frac{x-1}{x}=y$, then $x=\frac{1}{1-y}$. Substituting into the given condition, we have $f\left(\frac{1}{1-y}\right)+f(y)=\frac{y-2}{y-1}$, which means $f\left(\frac{1}{1-x}\right)+f(x)=\frac{x-2}{x-1}$.

Let $x=\frac{u-1}{u}$, substituting into the given condition, we have
$f\left(\frac{u-1}{u}\right)+f\left(\frac{1}{1-u}\right)=\frac{2 u-1}{u}$, which means $f\left(\frac{x-1}{x}\right)+f\left(\frac{1}{1-x}\right)=\frac{2 x-1}{x}$.
From the given condition and (1), (2), we get $f(x)=\frac{x^{2}-x-1}{x(x-1)}$.
Therefore, $f(2)=\frac{3}{2}$.