Consider the $n$th Fourier coefficients of $f$ i.e. $\hat f(n)= \frac{1}{2 \pi} \int_{- \pi}^{\pi} f(x) e^{-inx} dx$
Do a trivial computation to get, $\hat f(0) =0$ (since $f$ is odd!)
and for $n \ne 0$, $\hat f(n)= \frac{1-(-1)^n}{i \pi n}$ .Thus only odd terms survive!
Then, $\sum_{n=-\infty, }^{+\infty} \hat{f}(n) e^{inx}= \sum_{n=-\infty, \text{n odd}}^{+\infty}\frac{1-(-1)^n}{i \pi n} e^{inx}$ . Now coupling $n$th and $-n$th term together get,
$$\sum_{n=-\infty, }^{+\infty} \hat{f}(n) e^{inx}= \frac{4}{\pi}\sum_{k=1}^{\infty}\frac{sin(2k-1)x}{2k-1} \ldots (1)$$
Consider any neighborhood of the form $(\frac{\pi}{2}-\delta, \frac{\pi}{2}+\delta)$ where $0 < \delta < \frac{\pi}{2}$ , then on this interval $f =1$ and hence Lipschitz. Thus at the point $x=\frac{\pi}{2}$, the Fourier series of $f$ converges to $f(\frac{\pi}{2})$ .
Thus by (1) we get,
$$\frac{4}{\pi}\sum_{k=1}^{\infty}\frac{sin(2k-1)(\frac{\pi}{2})}{2k-1}=f(\frac{\pi}{2})$$
$$\implies \frac{4}{\pi}\sum_{k=1}^{\infty}\frac{(-1)^{k+1}}{2k-1}=1$$
$$ \implies1 - \frac{1}{3} + \frac{1}{5} - \frac{1}{7} + \dots = \frac{\pi}{4}$$
The easy part is to show that $f$ and $g$ have the same Fourier coefficients. The hard part is to show that $f$ and $g$ are identically equal.
First show that $f$ and $g$ have the same Fourier series.
From periodicity of the series, we can consider any interval $[\alpha, \alpha+ 2\pi]$, and adopting standard notation replace $a_0$ with $a_0/2$.
We have
$$\tag{1}g(x) = a_0/2 + \sum_{n=1}^\infty (a_n \cos nx + b_n \sin nx)$$
where the series is uniformly convergent on the interval, and, since each term in the series is continuous, it follows from uniform convergence that $g$ is continuous.
Multiplying by $\sin mx$ and integrating we get
$$\tag{2}\frac{1}{\pi} \int_{\alpha}^{\alpha + 2\pi}g(x) \sin mx \,dx \\= \frac{a_0}{2\pi}\int_{\alpha}^{\alpha + 2\pi}\sin mx \, dx +\frac{1}{\pi}\int_{\alpha}^{\alpha + 2\pi}\sum_{n=1}^\infty(a_n \cos nx \sin mx + b_n \sin nx \sin mx) \, dx.$$
Since (1) is uniformly convergent and $\sin mx$ is bounded, the series on the RHS of (2) is uniformly convergent and can be integrated term by term to obtain
$$\tag{3}\frac{1}{\pi} \int_{\alpha}^{\alpha + 2\pi}g(x) \sin mx \,dx \\= \frac{a_0}{2\pi}\int_{\alpha}^{\alpha + 2\pi}\sin mx \, dx +\sum_{n=1}^\infty\frac{a_n}{\pi}\left(\int_{\alpha}^{\alpha + 2\pi}\cos nx \sin mx \, dx \right) + \frac{b_n}{\pi} \left(\int_{\alpha}^{\alpha + 2\pi} \sin nx \sin mx \, dx \right)$$
All the integrals on the RHS of (3) vanish except the integral of $\sin nx \sin mx$ when $n = m$.
Hence,
$$\frac{1}{\pi} \int_{\alpha}^{\alpha + 2\pi}g(x) \sin mx \,dx = b_m = \frac{1}{\pi} \int_{\alpha}^{\alpha + 2\pi}f(x) \sin mx \,dx $$.
Similarly we can show
$$\frac{1}{\pi} \int_{\alpha}^{\alpha + 2\pi}g(x)\,dx = a_0 = \frac{1}{\pi} \int_{\alpha}^{\alpha + 2\pi}f(x)\,dx , \\ \frac{1}{\pi} \int_{\alpha}^{\alpha + 2\pi}g(x) \cos mx \,dx = a_m = \frac{1}{\pi} \int_{\alpha}^{\alpha + 2\pi}f(x) \cos mx \,dx. $$
Thus $f$ and $g$ have the same Fourier series.
It still remains to prove that $f = g$.
This follows by showing that if two continuous functions differ at just one point, $f(c) \neq g(c)$, then they cannot have the same Fourier series.
Take $h = f -g$. If $f$ and $g$ have identical Fourier series, then all Fourier coefficients of $h$ vanish, and for any trigonometric polynomial $T_m(x) = A_0/2 + \sum_{n=1}^{m} (A_n \cos nx + B_n \sin nx)$ we have for any $\alpha \in \mathbb{R}$,
$$\tag{4}\int_{\alpha}^{\alpha + 2\pi} h(x) T_m(x) \, dx = 0.$$
We also have $h(c) = f(c) - g(c) \neq 0$ and WLOG can assume that $h(c) > 0$. Since $h$ is continuous , there exists $K > 0$ and $\delta > 0$ such that $h(x) \geqslant K > 0$ when $x \in [c - \delta,c + \delta]$.
It can be shown that $T_m(x) = [1 + \cos(x-c) - \cos \delta]^m$ is a trigonometric polynomial satisfying
$$T_m(x) \geqslant 1 \text{ for } x \in [c-\delta,c+\delta] \\ \lim_{m \to \infty} T_m(x) = \infty \text{ uniformly on } [c - \delta/2, c+\delta/2] \\ |T_m(x)| \leqslant 1 \text{ for } x \in [c + \delta , c - \delta + 2\pi]
$$
From these properties it follows that
$$\tag{5} \int_{c - \delta}^{c + \delta} h(x) T_m(x) \, dx \geqslant \int_{c - \delta/2}^{c + \delta/2} h(x) T_m(x) \, dx \geqslant \delta \, K \, \inf T_m(x) $$
and $\int_{c + \delta}^{c - \delta + 2\pi} h(x) T_m(x) \, dx$ is bounded.
Since the RHS of (5) tends to $\infty$ as $m \to \infty$ it follows for sufficiently large $m$
$$\int_{c - \delta}^{c - \delta + 2\pi} h(x) T_m(x) \, dx \neq 0,$$
contradicting (4) and leading to the conclusion that if $f$ and $g$ differ at one point, they cannot have the same Fourier series.
Best Answer
Hint: Just consider it intuitively. Suppose that $$f=\sum_{n=1}^{N}b_n\sin\left(\frac{\pi n x}{L}\right)$$ then $$f^2=\sum_{n,k=1}^{N}b_{n}b_{k}\sin\left(\frac{\pi n x}{L}\right)\sin\left(\frac{\pi k x}{L}\right).$$ Since $$\int_{-L}^L \sin\left(\frac{\pi n x}{L}\right)\sin\left(\frac{\pi k x}{L}\right)dx=L\delta_{n,k}$$ we have that in this case $$\int_{-L}^L f^2 dx=L\sum_{n,k=1}^{N}b_{n}b_{k}\delta_{n,k}=L\sum_{n=1}^N b_n^2.$$ The square of the function will sum over all possible pairs, and pairs that aren't the same will integrate to zero. How can you extend this intuition for finite sums to infinite sums? The argument is also the same when you toss in cosines and a constant term.