For a pole of order at , the residue is . For the rational integral, close the real-axis contour with an upper semicircle. The poles are double at and simple at , with
The arc integral vanishes as . By the residue theorem the whole real-axis integral is , and evenness gives
For the second calculation, reciprocal expansion of the sine gives . Multiplying by yields . Therefore
At every nonzero integer , has a simple pole with residue one, giving residue after division by .
The cotangent contour summation uses the positively oriented square of half-side . Its length is and on its boundary. The supplied cotangent bound implies . Its enclosed residues sum to . The residue theorem therefore proves the Basel problem value
Figure 1.
Upper-half-plane and square contours for the rational integral and the Basel sum
. Original contour diagrams. Both are counterclockwise. The upper semicircle encloses poles at and ; the example square has half-side , enclosing the integer poles from to . Details.