Find $ S=\frac{\cos 2x}{1\cdot 3}+\frac{\cos 4x}{3\cdot 5}+\frac{\cos 6x}{5\cdot 7}+\dots=\sum_{n=1}^\infty\frac{\cos (2nx)}{(2n-1)(2n+1)} $ 
Find a sum of the series:
  $$
S=\frac{\cos 2x}{1\cdot 3}+\frac{\cos 4x}{3\cdot 5}+\frac{\cos 6x}{5\cdot 7}+\dots=\sum_{n=1}^\infty\frac{\cos (2nx)}{(2n-1)(2n+1)}
$$

My attempt:
$$
\begin{aligned}
&z=\cos x+i\sin x\\
&S=\frac{1}{2}\text{Re}\sum_{n=1}^\infty\frac{z^{2n}}{2n-1}-\frac{1}{2}\text{Re}\sum_{n=1}^\infty\frac{z^{2n}}{2n+1}
\end{aligned}
$$
But calculating these sums seems a bit difficult to me. Perhaps there is a better approach to this problem?
 A: Note that
$$1+z^2+z^4+\cdots = \frac{1}{1-z^2}.$$
Integrating both sides,
$$z+\frac{z^3}{3}+\frac{z^5}{5}+\cdots=\frac 12 (\log(1+z)-\log(1-z)) = \tanh^{-1}(z).$$
Observe that multiplying both sides by $z$ gives
$$\sum_{n=1}^\infty \frac{z^{2n}}{2n-1} = z\tanh^{-1}(z)$$
and multiplying the left hand side by $\frac 1z$ and subtracting the $1$ term gives
$$\sum_{n=1}^\infty \frac{z^{2n}}{2n+1} = -1 + \frac{\tanh^{-1}(z)}{z}.$$
Rewriting $\tanh^{-1}(z)$ as $\ln\left(\frac{1-z}{1+z}\right)$, remembering that $z$ is on the unit circle, we can draw vectors $1+z$ and $1-z$ in the complex plane. Doing some basic geometry, we can see that the angle between these is $\frac \pi 2$, and that the lengths of $1+z$ and $1-z$ are $2 \cos \left(\frac \theta 2 \right)$ and $2 \cos \left( \frac \pi 2 - \frac \theta 2 \right) = 2 \sin \left( \frac \theta 2 \right)$.
So $\frac{1-z}{1+z} = -i \cdot \tan \left(\frac x2 \right)$, and so the $\log$ of this is
$$-\frac{i \pi}{2} + \ln\left(\tan \left(\frac x2 \right)\right)$$
(since $\log(-i) = -\frac{i \pi}{2}$).
From here, everything is easily calculatable.
A: $$2S=\sum_{r=1}^\infty\dfrac{\cos2rx}{2r-1}-\sum_{r=1}^\infty\dfrac{\cos2rx}{2r+1}$$
which is real part of $$\sum_{r=1}^\infty\dfrac{(e^{ix})^{2r}}{2r-1}-\sum_{r=1}^\infty\dfrac{(e^{ix})^{2r}}{2r+1}$$
$$=e^{ix}\cdot\sum_{r=1}^\infty\dfrac{(e^{ix})^{2r-1}}{2r-1}-e^{-ix}\cdot\sum_{r=1}^\infty\dfrac{(e^{ix})^{2r+1}}{2r+1}$$
$$=e^{ix}\cdot\ln\dfrac{1-e^{ix}}{1+e^{ix}}-e^{-ix}\left(\ln\dfrac{1-e^{ix}}{1+e^{ix}}-1\right)$$
$$=(e^{ix}-e^{-ix})\left(\ln\dfrac{1-e^{ix}}{1+e^{ix}}\right)+e^{-ix}$$
$$=2i\sin x\left(\ln(-1)+\ln\dfrac{e^{ix/2}-e^{-ix/2}}{e^{ix/2}+e^{-ix/2}}\right)+\cos  x-i\sin x$$
$$=2i\sin x\left(\ln(-i)+\ln\tan\dfrac x2\right)+\cos  x-i\sin x$$
Now the principal value of $\ln(-1)$ is $-\dfrac{i\pi}2$
A: $\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,}
 \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\mc}[1]{\mathcal{#1}}
 \newcommand{\mrm}[1]{\mathrm{#1}}
 \newcommand{\pars}[1]{\left(\,{#1}\,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$
\begin{align}
&\underline{\underline{\mbox{Note that}}}\quad
\bbox[10px,#ffd]{\left.\sum_{n = 1}^{\infty}{\cos\pars{2nx} \over
\pars{2n - 1}\pars{2n + 1}}
\,\right\vert_{\ \color{red}{\large x\ \in\ \mathbb{C}}}}
\\[5mm] = &\
{1 \over 2}\sum_{n = 1}^{\infty}{\expo{2n x\ic} \over
\pars{2n - 1}\pars{2n + 1}} + \pars{x \to - x}\label{1}\tag{1}
\end{align}

\begin{align}
&\bbox[10px,#ffd]{{1 \over 2}\sum_{n = 1}^{\infty}{\expo{2n x\ic} \over
\pars{2n - 1}\pars{2n + 1}}} =
{1 \over 4}\sum_{n = 1}^{\infty}{\expo{2nx\ic} \over 2n - 1} -
{1 \over 4}\sum_{n = 1}^{\infty}{\expo{2nx\ic} \over 2n + 1}
\\[5mm] = &\
{1 \over 4}\sum_{n = 1}^{\infty}{\expo{2nx\ic} \over 2n - 1} -
{1 \over 4}\sum_{n = 2}^{\infty}{\expo{2nx\ic}\expo{-2xi} \over 2n - 1} =
{1 \over 4} + {1 \over 4}\pars{1 - \expo{-2xi}}
\sum_{n = 1}^{\infty}{\expo{2nx\ic} \over 2n - 1}
\\[5mm] = &\
{1 \over 4} + {1 \over 2}\,\ic\sin\pars{x}
\bbox[#eef,1px]{\expo{-xi}\sum_{n = 1}^{\infty}{\expo{2nx\ic} \over 2n - 1}}
\label{2}\tag{2}
\end{align}
Lets evaluate the $\ds{\bbox[5px,#eef]{\mbox{blue}}}$ expression in (\ref{1}):
\begin{align}
&\bbox[#eef,1px]{\expo{-xi}\sum_{n = 1}^{\infty}{\expo{2nx\ic} \over 2n - 1}} =
\expo{-xi}\sum_{n = 2}^{\infty}{\expo{nx\ic} \over n - 1}\,{1 + \pars{-1}^{n} \over 2} =
{1 \over 2}\sum_{n = 1}^{\infty}{\pars{\expo{x\ic}}^{n} \over n}
\bracks{1 - \pars{-1}^{n}}
\\[5mm] = &\
{1 \over 2}\sum_{n = 1}^{\infty}{\pars{\expo{x\ic}}^{n} \over n} -
{1 \over 2}\sum_{n = 1}^{\infty}{\pars{-\expo{x\ic}}^{n} \over n} =
-\,{1 \over 2}\ln\pars{1 - \expo{xi}} +
{1 \over 2}\ln\pars{1 + \expo{xi}}\label{3}\tag{3}
\end{align}
Replacing (\ref{3}) in (\ref{2}):
\begin{align}
&\bbox[10px,#ffd]{{1 \over 2}\sum_{n = 1}^{\infty}{\expo{2n x\ic} \over
\pars{2n - 1}\pars{2n + 1}}} =
{1 \over 4} + {1 \over 4}\,\ic\sin\pars{x}
\bracks{\ln\pars{1 + \expo{x\ic}} - \ln\pars{1 - \expo{x\ic}}}
\end{align}
The final result is found by replacing this result in (\ref{1}}:
\begin{align}
&\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!
\bbox[10px,#ffd]{\left.\sum_{n = 1}^{\infty}{\cos\pars{2nx} \over
\pars{2n - 1}\pars{2n + 1}}
\,\right\vert_{\ \color{red}{\large x\ \in\ \mathbb{C}}}}
\\[5mm] = &\ 
{1 \over 2}
\\[2mm]  + & {1 \over 4}\,\ic\sin\pars{x}
\bracks{\ln\pars{1 + \expo{x\ic}} - \ln\pars{1 - \expo{x\ic}} -
\ln\pars{1 + \expo{-x\ic}} + \ln\pars{1 - \expo{-x\ic}}}
\label{4}\tag{4}
\end{align}

When $\ds{x \in \mathbb{R}}$, (\ref{4}) is reduced to:
\begin{align}
\mrm{f}\pars{x} & =
\left\{\begin{array}{lcl}
\ds{\mrm{f}\pars{-x}} & \mbox{if} & \ds{x < 0}
\\[2mm]
\ds{{1 \over 2} - {1 \over 4}\,\pi\sin\pars{x}}                         & \mbox{if} & \ds{0 \leq x \leq \pi}
\\[2mm]
\ds{\mrm{f}\pars{x - \pi}} && \mbox{otherwise}
\end{array}\right.
\end{align}
$\ds{\mrm{f}\pars{x}}$ Graph" />
