I've been trying to numerically approximate various contour integrals of the function $f(z)=\frac{\sin\left(\pi x\right)}{\sin^2\left(\frac{15\pi}{x}\right)}$, but it seems that the residues and contour integrals disagree at / around some of the poles. For instance, consider the residue of the second order pole at $z=2.5$ The residue of the pole should be equal to the following limit: $$\lim_{z \to 2.5}\left [ \frac{d}{dz}\left(\left(z-2.5\right)^2\frac{\sin\left(\pi z\right)}{\sin^2\left(\frac{15\pi}{z}\right)}\right) \right ]$$
If you evaluate this limit you see that it goes to zero. And furthermore, executing the following in Mathematica or Wolfram Alpha also results in a value of zero for the residue. (I believe the way Mathematica finds residues is by finding the $a_{-1}$ of the Laurent series so this certainly should be the residue by definition).
Residue[Sin[Pi*z]/Sin[Pi*15/z]^2,{z,2.5}]
However, if I then ask Mathematica to numerically evaluate the contour integral around this same pole, I get an answer whose distance from zero is much greater than the calculated error of the integral. Here is an example of the code I used for this integration.
a=2.5;
R=0.001;
(1/(2*Pi))*NIntegrate[Sin[Pi*(a+R*Exp[t*I])]/Sin[Pi*15/(a+R*Exp[t*I])]^2*R*Exp[t*I],{t,0,2*Pi}]
This code calculates the integral by integrating along a circular contour centered at the pole whose radius is given by R. As such, the integral represented by this expression is the following:
$$\frac{R}{2\pi}\int_0^{2\pi}\frac{\sin\left(\pi\left(2.5+Re^{ti}\right)\right)}{\sin^2\left(\frac{15\pi}{\left(2.5+Re^{ti}\right)}\right)}e^{ti}dt$$
When this is run the output is $0.0140724 -4.98614\cdot10^{-15}i$. It's pretty safe to say that the true value of the imaginary part does indeed go to zero due to its size. However, the real part is far to large to be due to the expected error of NIntegrate alone.
However, it gets weirder. If you change the value of R to 0.0001, we get the exact same real part with another extremely small imaginary part as one would expect if the residue of the pole actually was 0.0140724. The same is true for other values of R ranging from 0.1 to 0.00001, after which Mathematica starts becoming unreliable due to the extremely high error estimates. As a result, it seems like the residue of the pole is actually 0.0140724, but we know this can't be the case, so what gives?
Some additional notes and observations:
There can't be any other nearby poles off the real line contributing to this behavior as the sin function only has roots on the real line and so therefore our function only has poles on the real line.
The function should be holomorphic (unless there's something I'm not seeing) in the region excluding the pole we're integrating around and so the residue theorem should apply.
The same weird behavior has been observed for every second order pole I've checked. However, all the first order poles seem to behave normally and their numeric contour integrals agree perfectly with their calculated residues.
There is clearly an essential singularity at $z=0$, and I'm not 100% sure this isn't the cause of the problems, but I wouldn't expect it to be causing issues being that it's outside the contours I've been using.
When the magnetiude of the function is graphed (shown below) in 3-Space there are some spikes which look a bit like poles next to the real line but, as we saw before, they can't be actual poles.
I was thinking these virtual poles (as I've been referring to them) may behave like poles under imperfect numerical integration. But if you look at the 2D complex plot of the function (shown below) it seems that the phase of the complex numbers around them don't behave like you would expect around a real pole, and so I'm not so sure this is the case after all.

