Evaluate $\sum_{n=0}^\infty \frac{\sin ((2n+1)\theta)}{(2n+1)}$ How to evaluate the value of
$$\sum_{n=0}^\infty \frac{\sin ((2n+1)\theta)}{(2n+1)}$$
My try:: I tried similar manipulating Proving a trig infinite sum using integration , but I am getting constant.
$$\log ( 1 + e^{i \theta}) - \log (1 - e^{i \theta}) = 2 \sum_{n=1}^{\infty} \frac{e^{i (2n+1)}}{2n+1}$$
Comparing imaginary parts on both sides, I am getting $\displaystyle \sum_{n=0}^\infty \frac{\sin ((2n+1)\theta)}{(2n+1)} = \frac{\pi}{4}$?
 A: I'll post anyway since my answer is a little different, using $\mathrm{Im}(\log(z))=\mathrm{arg(z)}$:
$$
\begin{align}
\sum_{n=0}^\infty\frac{\sin((2n+1)\theta)}{2n+1}
&=\mathrm{Im}\left(\sum_{n=0}^\infty\frac{e^{i(2n+1)\theta}}{2n+1}\right)\\
&=\mathrm{Im}\left(\frac12\log\left(\frac{1+e^{i\theta}}{1-e^{i\theta}}\right)\right)\\
&=\frac12\arg\left(\frac{e^{-i\theta/2}+e^{i\theta/2}}{e^{-i\theta/2}-e^{i\theta/2}}\right)\\
&=\frac12\arg\left(i\cot(\theta/2)\right)\\[6pt]
&=\frac\pi4\mathrm{sgn}(\cot(\theta/2))\\[6pt]
&=\frac\pi4\mathrm{sgn}(\sin(\theta))
\end{align}
$$
A: $$S(\theta) = \sum_{n=0}^{\infty} \dfrac{\sin((2n+1)\theta)}{2n+1} = \text{Imag}\left(\sum_{n=0}^{\infty} \dfrac{e^{i(2n+1)\theta}}{2n+1}\right) = \text{Imag}\left(\dfrac12 \ln \left(\dfrac{1+e^{i \theta}}{1-e^{i\theta}}\right)\right)$$
$$S(\theta) = \text{Imag}\left(\dfrac12 \ln \left(i \cot(\theta/2)\right)\right) = \dfrac12 \times \dfrac{\pi}2 = \begin{cases}\dfrac{\pi}4  & \text{if }\theta \in \left(2n \pi,(2n+1)\pi\right)\\ - \dfrac{\pi}4 & \text{if } \theta \in ((2n+1)\pi, (2n+2) \pi)\\ 0 & \text{if }\theta = n \pi \end{cases}$$

Edit: Another way is to look at the Fourier series of the function
$$f(x) = \begin{cases}-\dfrac{\pi}4 & x \in(-\pi,0)\\ 0 & x = 0\\ \dfrac{\pi}4 & x \in (0,\pi) \end{cases}$$
And conclude from this. (Note that since the function is odd, the $\cos$ terms go away.)
