Use the positively oriented unit circle and . Writing , the contour integral for a sine-squared trigonometric quotient becomes
There is a double pole at zero and simple poles at . Since , and . The coefficient of at zero is . At , the residue is
because . The residue theorem consequently gives
For the second integral, use with . The square root is , and reversing the integration limits gives
The last factor uses the symmetry of the integrand about over a full period. Therefore