How to calculate $ \left| \sin x \right| $ derivative in a more elegant way?

The better way, for me, is as follows: $$f(x)=|\sin(x)|=\sqrt{\sin^2(x)}$$ Now, differentiate both sides to get $$f'(x)=\frac{1}{2\sqrt{\sin^2(x)}}\cdot2\sin(x)\cos(x)=\frac{\sin(2x)}{2|\sin(x)|}$$ Therefore, $$\big(|\sin(x)|\big)'=\frac{\sin(2x)}{2|\sin(x)|}, \ \ \ \ x \neq k\pi, k\in \mathbb{Z}$$


Appendum: This approach can easily be extended to a general case of finding $\left(|f(x)|\right)'$.

First, we rewrite $$|f(x)| = \sqrt{f^2(x)}$$ Then, repeating the work above: $$|f(x)|' = \frac{1}{2\sqrt{f^2(x)}}[2f(x)f'(x)] = \frac{f(x)}{|f(x)|}f'(x)$$ we get $$\boxed{|f(x)|' = \frac{f(x)}{|f(x)|}f'(x)}$$


I think an even nicer way of thinking about it is in terms of the sign of $\sin(x)$ applied to the derivative of $\sin(x)$. A function $f$ that returns the sign of another function $g$ is: $f(x)=\frac{\lvert(g(x))\rvert}{g(x)}$ .
So quite simply $\lvert \sin(x) \rvert'=\frac{\lvert \sin(x)) \rvert}{\sin(x)}\cdot\cos(x)$

This is essentially just $\cos(x)$ but reflected across the axis at the intervals where $\sin(x)$ is negative, that is: $\cos(x)$ for $x \in [0,\pi]$ and $-\cos(x)$ for $x \in [\pi,2\pi]$ and so on. The reason for this is not difficult to see: when we take the absolute value of a function, then the gradients of the points belonging to the intervals that were flipped, here where $x \in [\pi,2\pi]$, are also flipped. So what ends up happening is that the derivative essentially stays the same, but is flipped on the intervals where the original function was flipped.