Computing $\frac {d}{dx} (\frac {|x|^{n+1}}{1-x})$ for $x \in (-1,0) \cup (0,1)$ and $n \in \Bbb N$ I am trying to compute $\frac {d}{dx} (\frac {|x|^{n+1}}{1-x})$ for $x \in (-1,0) \cup (0,1)$ and $n \in \Bbb N$ in order to understand an example given in my textbook. What I have so far is that
I get $\frac {d}{dx} (\frac {|x|^{n+1}}{1-x}) = 
\frac {(n+1)|x|^n \frac {|x|}{x} (1-x) - ((-1)|x|^{n+1})} {(1-x)^2}$
= $ \frac {(n+1)|x|^{n+1} \frac {1}{x}(1-x)+|x|^{n+1}} {(1-x)^2}$, 
now this is supposed to be equal (as per my notes) to $\frac {n x^{n}(1-x)+x^{n+1}}{(1-x)^2}$. 
Where have I made a mistake? 
 A: To help you understand Dzoooks' comment, the issue is that the function $f$ defined by $f(x)=|x|$ is nondifferentiable at the point zero, and hence the derivative of your function is not defined there.
However, the derivative is still well-defined away from zero (aside from the discontinuity in the original function at $x=1$).
Namely, if $x>0$ and $x\neq1$, then
$$
\frac{\left|x\right|^{n+1}}{1-x}=\frac{x^{n+1}}{1-x}.
$$
Taking the derivative of the above, we get
$$
\frac{d}{dx}\left[\frac{x^{n+1}}{1-x}\right]=\frac{x^{n}\left(n+1-nx\right)}{\left(1-x\right)^{2}}.
$$
If, on the other hand, $x<0$, then
$$
\frac{\left|x\right|^{n+1}}{1-x}=\frac{\left(-x\right)^{n+1}}{1-x}.
$$
Taking the derivative of the above, we get
$$
\frac{d}{dx}\left[\frac{\left(-x\right)^{n+1}}{1-x}\right]=\left(-1\right)^{n+1}\frac{x^{n}(n+1-nx)}{\left(1-x\right)^{2}}.
$$
Putting it all together, we can conclude
$$
\frac{d}{dx}\left[\frac{\left|x\right|^{n+1}}{1-x}\right]=\frac{x^{n}(n+1-nx)}{\left(1-x\right)^{2}}\times\begin{cases}
1 & \text{if }x>0\text{ and }x\neq1\\
\left(-1\right)^{n+1} & \text{if }x<0
\end{cases}
$$
