$f(x) = |\sin(x)| \quad \Rightarrow\quad f(x) = \left\{
\begin{array}{l l}
-\sin(x) & \quad \forall x \in [- \pi, 0\space]\\
\sin(x) & \quad \forall x \in [\space 0,\pi\space ]\\
\end{array} \right.$
The Fourier coefficients associated are
$$a_n= \frac{1}{\pi}\int_{-\pi}^\pi f(x) \cos(nx)\, dx = \frac{1}{\pi} \left[\int_{-\pi}^0 -\sin (x) \cos(nx)\, dx + \int_{0}^\pi \sin(x) \cos(nx)\, dx\right], \quad n \ge 0$$
$$b_n= \frac{1}{\pi}\int_{-\pi}^\pi f(x) \sin(nx)\, dx = \frac{1}{\pi} \left[\int_{-\pi}^0 -\sin (x) \sin(nx)\, dx + \int_{0}^\pi \sin(x) \sin(nx)\, dx\right], \quad n \ge 1$$
All functions are integrable so we can go on and compute the expressions for $a_n$ and $b_n$.
$$a_n = \cfrac{2 (\cos(\pi n)+1)}{\pi(1-n^2)}$$
$$b_n = 0$$
The $b_n = 0$ can be deemed obvious since the function $f(x) = |\sin(x)|$ is an even function. and $a_n$ could have been calculated as $\displaystyle a_n= \frac{2}{\pi}\int_{0}^\pi f(x) \cos(nx)\, dx $ only because the function is even.
The Fourier Series is $$\cfrac {a_0}{2} + \sum^{\infty}_{n=1}\left [ a_n \cos(nx) + b_n \sin (nx) \right ]$$
$$= \cfrac {2}{\pi}\left ( 1 + \sum^{\infty}_{n=1} \cfrac{(\cos(\pi n)+1)}{(1-n^2)}\cos(nx)\right )$$
$$= \cfrac {2}{\pi}\left ( 1 + \sum^{\infty}_{n=1} \cfrac{((-1)^n+1)}{(1-n^2)}\cos(nx)\right )$$
$$= \cfrac {2}{\pi}\left ( 1 + \sum^{\infty}_{n=1} \cfrac{2}{(1-4n^2)}\cos(2nx)\right )$$
Since for an odd $n$, $((-1)^n+1) = 0$ and for an even $n$, $((-1)^n+1) = 2$
At this point we can't just assume the function is equal to its Fourier Series, it has to satisfy certain conditions. See Convergence of Fourier series.
Without wasting time, (you still have to prove that it satisfies those conditions) we assume the Fourier Series converges to our function i.e
$$f(x) = |\sin(x)| = \cfrac {2}{\pi}\left ( 1 + \sum^{\infty}_{n=1} \cfrac{2}{(1-4n^2)}\cos(2nx)\right )$$
Note that $x=0$ gives $\cos(2nx) = 1$ then
$$f(0) = |\sin(0)| = \cfrac {2}{\pi}\left ( 1 + 2\sum^{\infty}_{n=1} \cfrac{1}{(1-4n^2)}\right ) =0$$ which implies that
$$\sum^{\infty}_{n=1} \cfrac{1}{(1-4n^2)} = \cfrac {-1}{2}$$ and $$\boxed {\displaystyle\sum^{\infty}_{n=1} \cfrac{1}{(4n^2 -1)}= -\sum^{\infty}_{n=1} \cfrac{1}{(1-4n^2)} = \cfrac {1}{2}}$$
Observe again that when $x = \cfrac \pi 2$, $\cos (2nx) = cos(n \pi) = (-1)^n$, thus
$$f \left (\cfrac \pi 2 \right) = \left |\sin \left (\cfrac \pi 2\right )\right | = \cfrac {2}{\pi}\left ( 1 + 2\sum^{\infty}_{n=1} \cfrac{(-1)^n}{(1-4n^2)}\right ) =1$$ which implies that
$$\sum^{\infty}_{n=1} \cfrac{(-1)^n}{(1-4n^2)} = \cfrac {1}{4}(\pi -2)$$ and $$\boxed {\displaystyle\sum^{\infty}_{n=1} \cfrac{(-1)^n}{(4n^2 -1)}= -\sum^{\infty}_{n=1} \cfrac{(-1)^n}{(1-4n^2)} = \cfrac {1}{4}(2-\pi)}$$
Just use:
$$e^{ikx} = \cos(kx) + i\sin(kx)$$
Generally, if the fourier transform is real, you'll have terms like $e^{ikx}+e^{-ikx}$ that cancel out the imaginary part. In your case, divide the infinite series into three parts:
$$\sum_{k=-\infty}^{\infty} =\sum_{k=-\infty}^{-1} + \sum_{k=1}^{\infty} + \sum_{k=0}^{0}$$
Notice how you now get terms like $e^{ikx}+e^{-ikx}=2\cos(kx)$, or $e^{ikx}-e^{-ikx}=2i\sin(kx)$.
Best Answer
Expand the exponential form of $\cot x$: \begin{align}\cot x=\frac{i(e^{ix}+e^{-ix})}{e^{ix}-e^{-ix}}&=i+\frac{2ie^{-ix}}{e^{ix}-e^{-ix}}=i+2ie^{-2ix}(1+e^{-2ix}+e^{-4ix}+\cdots)\\[1ex] &=i+2i\sum_{k\ge1}(\cos2kx-i\sin2kx) \end{align}