Recall the definition of absolute value.
[tex]|x| = \begin{cases} x & \text{if } x \ge 0 \\ -x & \text{if } x < 0 \end{cases}[/tex]
When [tex]x<0[/tex],
[tex]|x| = x \implies \dfrac{d|x|}{dx} = 1[/tex]
When [tex]x<0[/tex],
[tex]|x| = -x \implies \dfrac{d|x|}{dx} = -1[/tex]
The derivative does not exist at [tex]x=0[/tex], since the one-sided limits
[tex]\displaystyle \lim_{x\to0^-} f'(x) = -1[/tex]
and
[tex]\displaystyle \lim_{x\to0^+} f'(x) = +1[/tex]
do not match.
So the derivative of [tex]|x|[/tex] is
[tex]\dfrac{d|x|}{dx} = \begin{cases} 1 & \text{if } x > 0 \\ -1 & \text{if } x < 0 \\ \text{undefined} & \text{if } x = 0\end{cases}[/tex]
Now we can write this as
[tex]\dfrac{d|x|}{dx} = \dfrac x{|x|} = \dfrac{|x|}x[/tex]
since
[tex]x > 0 \implies |x| = x \implies \dfrac{|x|}x = \dfrac xx = 1[/tex]
and
[tex]x < 0 \implies |x| = -x \implies \dfrac{|x|}x = -\dfrac xx = -1[/tex]