<s>[INST] How to prove that $\csc^2x=\sum_{-\infty}^{\infty}\frac{1}{(x-n\pi)^2}$ I was reading the book The Princeton Companion to Mathematics
On page $293$, there is a statement 
$$\csc^2x=\sum_{n=-\infty}^{\infty}\frac{1}{(x-n\pi)^2}\tag{1}$$
Here is one method from the book:

Observe first that
  $$h(x)= \sum_{n=-\infty}^{\infty}\frac{1}{(x-n\pi)^2}$$
  is well-defined for each real $x$ that is not a multiple of $\pi$. Note also that $h(x+\pi)=h(x)$ and $h(\frac{1}{2}\pi-x) = h(\frac{1}{2}\pi+x)$. Set $f(x) = h(x) - \csc^2(\pi x)$. By showing that there are constans $K_1$ and $K_2$ such that 
  $$0<\sum_{n=1}^{\infty}\frac{1}{(x-n\pi)^2}<K_1$$
  and 
  $$0<\csc^2x-\frac{1}{x^2}<K_2$$
  for all $0<x\leq\frac{1}{2}\pi$, we deduce that there is a constant $K$ such that $|f(x)|<K$ for all $0<x<\pi$. Simple calculations show that 
  $$f(x)=\frac{1}{4}\left(f\left(\frac{1}{2}x\right)+f\left(\frac{1}{2}(x+\pi)\right)\right). \tag{2}$$
  A single application of $(2)$ shows that $|f(x)|<\frac{1}{2}K$ for all $0<x<\pi$, and repeated applications show that $f(x) = 0$. Thus
  $$\csc^2x=\sum_{n=-\infty}^{\infty}\frac{1}{(x-n\pi)^2}$$
  for all real noninteger $x$.

Are here other methods to prove (1)?
 [/INST] METHODOLOGY $1$:  FOURIER SERIES
We begin by writing the Fourier series, 
$$\cos(xy)=a_0/2+\sum_{n=1}^\infty a_n\cos(nx) \tag1$$
for $x\in [-\pi/\pi]$.  The Fourier coefficients are given by
$$\begin{align}
a_n&=\frac{2}{\pi}\int_0^\pi \cos(xy)\cos(nx)\,dx\\\\
&=\frac1\pi (-1)^n \sin(\pi y)\left(\frac{1}{y +n}+\frac{1}{y -n}\right)\tag2
\end{align}$$
Substituting $2$ into $1$, dividing by $\sin(\pi y)$ reveals
$$\begin{align}
\pi \cos(xy)/\sin(\pi y)&=\frac1y +\sum_{n=1}^\infty (-1)^n\left(\frac{1}{y -n}+\frac{1}{y +n}\right)\cos(nx)\\\\
&=\sum_{n=-\infty}^\infty \frac{(-1)^n\cos(nx)}{y-n}\tag3
\end{align}$$
Now differentiate with respect to $y$, set $x=\pi$, then put $y=x/\pi$, and divide by $\pi^2$.  Can you finish?

METHODOLOGY $2$:  PRODUCT REPRESENTATOIN OF THE SINE FUNCTION
As another way forward, we note that 
$$\sin(\pi x)=\pi x\prod_{n=1}^\infty\left(1-\frac{x^2}{n^2}\right)$$
Taking the logarithm, and differentiating reveals
$$\begin{align}
\pi \cot(\pi x)&=\frac1x +\sum_{n=1}^\infty \frac{2x}{x^2-n^2}\\\\
&=\sum_{n=-\infty}^\infty \frac{1}{x-n}
\end{align}$$
Differentiating again and enforcing the substitution $x\to x/\pi$ and dividing by $\pi^2$ yields
$$\csc^2(x)=\sum_{n=-\infty}^\infty \frac{1}{(x-n\pi)^2}$$
</s>