4. If the equation in terms of $x$
$$
\frac{1}{x^{2}-x}+\frac{k-5}{x^{2}+x}=\frac{k-1}{x^{2}-1}
$$

has an extraneous root $x=1$, then the value of $k$ is ( ).
(A) 1
(B) 2
(C) 3
(D) 6
4.C.

From the original equation, we get
$$
\frac{1}{x(x-1)}+\frac{k-5}{x(x+1)}=\frac{k-1}{(x+1)(x-1)}
$$

Eliminating the denominators, we get
$$
x+1+(k-5)(x-1)=(k-1) x \text {. }
$$

Let $x=1$, we get $k=3$.