I am trying to prove this sum formula:$$\sum_{n=-\infty}^\infty g(n)=\frac1{2i}\oint_{|x|=\infty}\frac{\cos \pi x}{\sin \pi x}g(x)\,\mathrm dx.$$I do not understand why $\cos \pi x$ is needed here. This is because poles of $\sin \pi x$ are at $x=0,\pm 1,\pm 2,\cdots$
Any help will be highly appreciated.