How to evaluate integral: $ \int_{0}^{\infty} e^{-x}\left|\sin{x}\right| \ dx $

$$\int_{0}^{+\infty}e^{-x}|\sin x|\,dx =\sum_{k\geq 0}\int_{k\pi}^{(k+1)\pi}e^{-x}|\sin x|\,dx=\sum_{k\geq 0}(-1)^k\int_{k\pi}^{(k+1)\pi}e^{-x}\sin(x)\,dx$$ equals $$ \sum_{k\geq 0}\int_{0}^{\pi}e^{-x-k\pi}\sin(x)\,dx =\int_{0}^{\pi}\sin(x)e^{-x}\sum_{k\geq 0}e^{-k\pi}\,dx=\frac{1}{1-e^{-\pi}}\int_{0}^{\pi}e^{-x}\sin(x)\,dx$$ or $$ \frac{1}{1-e^{-\pi}}\,\text{Im}\int_{0}^{\pi}e^{(i-1)x}\,dx=\frac{1}{1-e^{-\pi}}\,\text{Im}\left[\frac{e^{(i-1)x}}{i-1}\right]_{0}^{\pi} =\frac{1}{1-e^{-\pi}}\,\text{Im}\left[\frac{-e^{-\pi}-1}{i-1}\right]=\frac{1}{2}\cdot\frac{1+e^{-\pi}}{1-e^{-\pi}}$$ that is $\color{blue}{\frac{1}{2}\coth\left(\frac{\pi}{2}\right)}$.


The problem comes from the fact that your antiderivative has discontinuities where $\sin x$ changes sign, and is not differentiable.

The correct integral can be found by summing the "jumps" required to restore continuity. (These jumps have amplitude $(-1)^ke^{-k\pi}$).