$f(x)=\sum_0^\infty\frac{\sin(2n +1) x}{2n+1}$ is the Fourier expansion of $(-1)^m\frac{\pi}{4}$ for $x\in (m\pi,(m+1)\pi),m\in \mathbb Z$. Suppose given $f(x)=\sum_0^\infty\frac{\sin(2n +1) x}{2n+1}$. I want to identify $f(x)$ as $(-1)^m\frac{\pi}{4}$ for $x\in (m\pi,(m+1)\pi),m\in \mathbb Z$.
I am only considering this function as $x\in \mathbb R$ real number case. From Dirichlet test, it is clear that $f$ is absolute convergent on any bounded disk on real line.(The only place that fails is possibly $x=\frac{\pi}{2(2n+1)}$. Finite geometric sums of $e^{i(2n+1) x}$ are always bounded unless $1$ is hit. And $\frac{1}{2n+1}$ is decreasing real sequence. Hence it passes Dirichlet test.)
According to the book by Titchmarsh, Theory of Zeta Functions pg 17 of Sec 2.2. $f(x)$ is $(-1)^m\frac{\pi}{4}$.
$\textbf{Q:}$ How do I know $f(x)$ is indeed $(-1)^m\frac{\pi}{4}$? My heuristic(non-rigorous argument) is to take derivative and test derivative on the on rational points. All derivative on rational points vanishes. If $f$ is a good function, then I certainly hope $f\in C^2$ up to some mild bad points and this will certainly happen. So $f$ is more or less piecewise constant function. From periodic property, I know $f$ has to be asymmetric against $\pi$. So I can use ansatz $f$ being piecewise constant function to check. However, this is purely "hoping". Is there a way to sum this expansion to deduce $(-1)^m\frac{\pi}{4}$ explicitly? In other words, given Fourier expansion of $f$, I would like to see how to concretely recover the original function via summation or any other methods without a priori acknowledgement of $f$'s form.
 A: The summation can be done explicitly using complex exponential form for sine. Here are some of the steps:
$$f(x)=\sum_0^\infty\frac{\sin(2n +1) x}{2n+1} = \frac{1}{2i}\sum_0^\infty\frac{e^{i(2n+1)x} - e^{-i(2n+1)x}}{2n+1} $$
Add and subtract $\sum_0^\infty\frac{e^{i(2n+2)x}}{2n+2}$ to the first exponential and $\sum_0^\infty\frac{e^{-i(2n+2)x}}{2n+2}$ to the second exponential to get
$$f(x) = \frac{1}{2i}\sum_1^\infty \left[\frac{e^{inx}}{n} - \frac{1}{2}\frac{e^{2inx}}{n} - \left(\frac{e^{-inx}}{n} -\frac{1}{2}\frac{e^{-2inx}}{n} \right) \right] $$
Now, use
$$-\ln(1-e^{ix}) = \sum_1^\infty{\frac{e^{inx}}{n}} $$
to get
\begin{align}
f(x) &= \frac{1}{2i}\sum_1^\infty \left[{-\ln(1-e^{ix})} - \frac{1}{2} \left(-\ln(1-e^{2ix}) \right) - \left({-\ln(1-e^{-ix})} - \frac{1}{2}\left(-\ln(1-e^{-2ix}) \right) \right) \right] \\
&= \frac{1}{2i}\sum_1^\infty \left[{-\ln(1-e^{ix})} + \frac{1}{2}\ln(1-e^{2ix}) + \ln(1-e^{-ix}) - \frac{1}{2} \ln(1-e^{-2ix}) \right]
\end{align}
Use, $\ln(1-e^{-ix}) = \ln(-e^{-ix}(1-e^{ix})) = \ln(-1) + \ln(e^{-ix}) + \ln(1-e^{ix}) $ to expand $e^{-ix}$ and $e^{-2ix}$ terms. Put this in the summation and after some algebra the result follows.
