Compute $\sum_{n=1}^\infty \frac{\cos(n\phi)}{n}$ where $0<\phi<\pi$ Compute $\sum_{n=1}^\infty \frac{\cos(n\phi)}{n}$ where $0<\phi<\pi$
From advance calculus I learn that , I need to find the partial sum and stuff. But from complex analysis class, my professor told me that I can turn this into integral form, but he didn't tell me how.
I wonder if anyone please show me how to turn this to integral form.
 A: Hint. One may recall that
$$
-\log (1-z)=\sum_{n=1}^\infty \frac{z^{n}}{n}, \quad |z|<1,
$$
giving, for $0<\phi<\pi$,
$$
\begin{align} \tag{1}
\sum_{n=1}^\infty \frac{\cos(n\phi)}{n}&=\Re\sum_{n=1}^\infty \frac{e^{in\phi}}{n}\\\\ \tag{2}
&=-\Re\:\log (1-e^{i\phi})\\\\ \tag{3a}
&=-\Re\:\log \left(-e^{i\phi/2}\left(e^{i\phi/2}-e^{-i\phi/2}\right)\right)\\\\ \tag{3b}
&=-\Re\:\log \left(-2ie^{i\phi/2}\sin (\phi/2)\right)\\\\ \tag{3c}
&=-\Re\:\log \left(2e^{i(\phi/2-\pi/2)}\sin ( \phi/2)\right)\\\\ \tag{4}
&=-\log \left(2 \sin ( \phi/2)\right).
\end{align}
$$
A: Here is another approach
$$
\begin{align}
\sum_{n=1}^\infty\frac{\cos(n\phi)}{n}
&=\frac12\sum_{n=1}^\infty\frac{e^{in\phi}}{n}+\frac12\sum_{n=1}^\infty\frac{e^{-in\phi}}{n}\\
&=-\frac12\log(1-e^{i\phi})-\frac12\log(1-e^{-i\phi})\\
&=-\frac12\log(2-2\cos(\phi))\\
&=-\frac12\log(4\sin^2(\phi/2))\\[6pt]
&=-\log(2\sin(\phi/2))
\end{align}
$$
This is valid for $0\lt\phi\le\pi$ because we used $\sqrt{\sin^2(\phi/2)}=\sin(\phi/2)$. However, if we use $\sqrt{\sin^2(\phi/2)}=|\sin(\phi/2)|$, we get
$$
\sum_{n=1}^\infty\frac{\cos(n\phi)}{n}
=-\log(2|\sin(\phi/2)|)
$$
which is valid for $-\pi\le\phi\le\pi$ except for $\phi=0$.
