I am trying to integrate the function $g(z):=\frac{\cos(\pi z)}{z^2\sin(\pi z)}$ over the square with vertices $(\pm 1\pm i)(N+1/2)$ as $N\to \infty$.
For the top and bottom sides, plugging in $z=(N+1/2)x\pm (N+1/2)i$, $\cos(\pi z)\approx 1/2e^{-i(N+1/2)x\pi}e^{(N+1/2)\pi)}$, $\sin(\pi z)\approx -1/(2i)e^{-i(N+1/2)x\pi}e^{(N+1/2)\pi)}$, so the integral become $\int_{-(N+1/2)}^{N+1/2} \frac{1}{((N+1/2)(x+i))^2}dx$ which goes to zero.
For the left and right sides, I am doing a similar thing, but it is even more sketchy because I have to argue that $e^{(N+1/2)\pi x}$ terms dominate $\cos$ and $\sin$ and then cancel in the fraction so we end up with a $1/x^2$ kind of thing again. Thus the whole integral is zero.
This all seems very messy and unappealing, and I'm not even completely convinced it is correct. Is there a better way of doing this problem? The whole point of the problem is to prove the $\sum 1/k^2=\pi^2/6$ identity, so I believe I do actually need to directly prove the integral is zero, but this just seems messy.
Let us consider again the argument. To make things "convincing", it is a good idea to let $\exp$ (alone) enter the stage.
The problem is related to the estimation of the function $$ z\mapsto h(z)=\cot (\pi z) =\frac{\cos (\pi z)}{\sin (\pi z)} =2i\cdot\frac{e^{\pi iz}+e^{-\pi iz}}{e^{\pi iz}-e^{i\pi iz}} =2i\cdot\frac{e^{2\pi i z}+1}{e^{2\pi i z}-1}\ . $$
So $h$ is uniformly bounded. The factor $\frac 1{z^2}\in O(N^{-2})$ is stronger than the contour length, which is $O(N)$, so the integral converges to $0$ for $N\to\infty$.