It would be great if someone can help me do these integrals - using numerical integration on Mathematica it seems that these converge - in what follows $a \in \mathbb{R}$ and $q \in \mathbb{N}$ and $n \in \mathbb{Z}$

$\int _0 ^\infty dx\text{ } tanh (\pi \sqrt{x} )[ \frac{1}{x + a^2 + (\frac{n}{q})^2 } - \frac{1}{x + a^2 + n^2 } ] $

$\int_0 ^\infty dx \text{ }\frac{tanh(\pi \sqrt{x})}{\sqrt{x + a^2 } } [ coth (\pi q \sqrt{x + a^2 } ) - coth (\pi \sqrt{x + a^2 } ) ] $

I am wondering if there is some complex analysis trick that can help here...