Example 7 If $P(x)$ is an $n$-degree polynomial, and for $k=0,1,2, \cdots, n$, we have $P(k)=\frac{k}{k+1}$, try to determine $P(n+1)$.

---

The translation maintains the original text's format and line breaks as requested.
Analysis Let $Q(x)=(x+1) \cdot P(x)-x$, then $Q(x)$ is a polynomial of degree no more than $n+1$, and when $x=0,1,2, \cdots, n$, we have $Q(x)=0$. By the factor theorem, we can obtain the expression for $Q(x)$.

Solution Let $Q(x)=(x+1) \cdot P(x)-x$. From the given conditions, we know that $Q(x)$ is a polynomial of degree no more than $n+1$, and when $x=0,1,2, \cdots, n$, we have $Q(x)=0$. Therefore, $Q(x)=a x(x-1)(x-2) \cdots(x-n)$, where $a$ is a constant. Thus, $(x+1) P(x)-x=a x(x-1)(x-2) \cdots(x-n)$. Let $x=-1$, we get $1=a \cdot(-1)^{n+1} \cdot(n+1)!$,
which means $a=\frac{(-1)^{n+1}}{(n+1)!}$. Therefore,
$$
P(x)=\frac{Q(x)+x}{x+1}=\frac{\frac{(-1)^{n+1}}{(n+1)!}(x-1)(x-2) \cdots(x-n)+x}{x+1}
$$

Hence $P(n+1)=\frac{(-1)^{n-1}+n+1}{n+2}$, that is, $P(n+1)=\left\{\begin{array}{l}1, n \text { is odd } \\ \frac{n}{n+2}, n \text { is even }\end{array}\right.$.