Doubts about derivative of $|x|$ We know that the derivative of $f(x)=|x|$ is $-1$, if $x\lt 0$ and $1$, if $x\ge 0$. 
However for every $x\in \mathbb R$, the following holds
$f(x)=|x|=\sqrt{x^2}\implies f'(x)=\frac{1}{2}(x^2)^{-1/2}2x=1$.
So where is my mistake?

As you said
$$ f(x) = \sqrt{x^2} = |x| = \begin{cases} x, & \text{if } x\ge0\\ -x, & \text{if } x < 0, \end{cases} $$
then 
$$\frac{1}{\sqrt{x^2}} = \frac{1}{|x|} = \begin{cases} \frac{1}{x}, & \text{if } x > 0, \\ -\frac{1}{x} , & \text{if } x < 0. \end{cases}$$
Hence
$$ f′(x)=\frac{1}{2}(x^2)^{−1/2}2x=\frac{x}{|x|} = \begin{cases}1, & \text{if } x > 0, \\ -1, & \text{if } x < 0. \end{cases} $$
