Example 4 If $P(x)$ represents an $n$-degree polynomial, and when $k=0,1, \cdots, n$, $P(k)=\frac{k}{k+1}$, try to find the expression for $P(n+1)$.
Solution: Let
$$
P(x)=a_{n} x^{n}+a_{n-1} x^{n-1}+\cdots+a_{1} x+a_{0} .
$$

Since $P(k)=\frac{k}{k+1}$, we have
$$
(k+1) P(k)-k=0 \quad (k=0,1, \cdots, n) \text {. }
$$

Construct the function $f(x)=(x+1) P(x)-x$.
Thus, when $x=0,1, \cdots, n$, $f(x)=0$, where $f(x)$ is an $(n+1)$-degree polynomial in $x$.

Let $f(x)=a x(x-1)(x-2) \cdots(x-n)$ (where $a$ is a constant to be determined). Therefore,
$$
\begin{array}{l}
(x+1) P(x)-x \\
=a x(x-1)(x-2) \cdots(x-n)
\end{array}
$$

holds true.
Let $x=-1$, we get $1=a(-1)^{n+1}(n+1)!$.
Thus, $a=\frac{(-1)^{n+1}}{(n+1)!}$.
Then $P(x)=\frac{f(x)+x}{x+1}$
$$
=\frac{1}{x+1}\left[\frac{(-1)^{n+1}}{(n+1)!} \cdot x(x-1) \cdots(x-n)+x\right] \text {. }
$$

Let $x=n+1$, we get
$$
P(n+1)=\frac{n+1+(-1)^{n+1}}{n+2} \text {. }
$$

Therefore, $P(n+1)=\left\{\begin{array}{ll}1, & n=2 k+1 ; \\ \frac{n}{n+2}, & n=2 k .\end{array}\right.$