A pole of order at has extending holomorphically to a nonzero value there. Its residue is the coefficient of in the Laurent series. The Cauchy integral theorem gives for a closed contour in a simply connected domain of holomorphicity. The residue theorem replaces zero by times the enclosed residues for a positively oriented simple contour avoiding finitely many poles.
For the first integral, use the upper-half-plane semicircle, with a small clockwise upper semicircle excluding the origin. Near zero,
There are no poles inside the indented contour. The large arc vanishes because and the integrand there is ; the small arc tends to . Therefore the real-axis complex principal value is . Taking real parts gives the ordinary convergent cosine-difference inverse-square integral
The real numerator cancels to second order at zero, so this final real integral itself needs no principal-value convention.
For , the simple poles are , . Differentiating the denominator gives
Integrate around the rectangle with vertices . It contains only . On the top side , and reversed traversal therefore contributes times the bottom integral. The vertical sides vanish for . The residue theorem gives , so the exponential moment of the hyperbolic secant is
Figure 1.
Indented semicircle and height-one rectangle for the two real integrals
. Original contour diagrams. The left contour excludes the origin with a clockwise indentation; the right encloses only the pole . Other hyperbolic-secant poles are shown outside the rectangle. Details.