Contour integration of $\int_{0}^{\pi}\tan{(\theta+ia)}d\theta$ I'm having real trouble with this one. This is my working so far.
$$I = \int_{0}^{\pi}\tan{(\theta+ia)d\theta} = \frac{1}{2}\int_{0}^{2\pi}\frac{\sin{(\theta+ia)}}{\cos{(\theta+ia)}}d\theta \\
=\frac{1}{2}\int_{0}^{2\pi}\frac{\sin{(ia)}\cos\theta+\cos{(ia)}\sin\theta}{\cos{(ia)}\cos\theta - \sin{(ia)}\sin\theta}d\theta \\
=\frac{1}{2}\int_{0}^{2\pi}\frac{i\sinh{(a)}\frac{z+1 / z}{2}+\cosh{(a)}\frac{z-1 / z}{2i}}{\cosh{(a)}\frac{z+1 / z}{2} - i\sinh{(a)}\frac{z-1 / z}{2i}}\cdot \frac{1}{iz}dz\\
=\frac{1}{2}\int_{0}^{2\pi}\frac{z(i\sinh{(a)}(z^2+1)-i\cosh{(a)}(z^2-1))}{z(\cosh{(a)}(z^2+1) - \sinh{(a)}(z^2-1))}\cdot \frac{1}{iz}dz\\
=\frac{1}{2}\int_{0}^{2\pi}\frac{i(\sinh{(a)}(z^2+1)-\cosh{(a)}(z^2-1))}{\cosh{(a)}(z^2+1) - \sinh{(a)}(z^2-1)}\cdot \frac{1}{iz}dz$$
I'm not sure how to find the residue past this point. Any help is appreciated!
Edit: Missing brackets in the title.
 A: \begin{align}
\cos(\theta +ia)&=\frac{e^{i(\theta +ia)}+e^{-i(\theta +ia)}}{2}=\frac{e^{-a}e^{i\theta }+e^{a}e^{-i\theta }}{2}=\frac{e^{2i\theta }+e^{2a}}{2e^ae^{i\theta }},\\
\sin(\theta +ia)&=\frac{e^{i(\theta +ia)}-e^{-i(\theta +ia)}}{2i}=\frac{e^{-a}e^{i\theta }-e^{a}e^{-i\theta }}{2i}=\frac{e^{2i\theta }-e^{2a}}{2ie^ae^{i\theta }}.
\end{align}
Therefore the integral becomes
\begin{align}
I=-\frac{i}{2}\int _0^{2\pi}\frac{e^{2i\theta} -e^{2a}}{e^{2i\theta} +e^{2a}}d\theta=-\frac{1}{2} \int _{|z|=1}\frac{z^2 -e^{2a}}{z^2+e^{2a}}\cdot\frac{dz}{z},
\end{align}
since $d\theta =dz/(iz)$ for $z=e^{i\theta }$.
Use Residue theorem for the last integral.
A: $\newcommand{\bbx}[1]{\,\bbox[8px,border:1px groove navy]{\displaystyle{#1}}\,}
 \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\mc}[1]{\mathcal{#1}}
 \newcommand{\mrm}[1]{\mathrm{#1}}
 \newcommand{\pars}[1]{\left(\,{#1}\,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$

An alternative: With $\ds{a \in \mathbb{R}}$:

\begin{align}
&\int_{0}^{\pi}\tan\pars{\theta + a\ic}\,\dd\theta =
\int_{0}^{\pi/2}\tan\pars{\theta + a\ic}\,\dd\theta +
\int_{-\pi/2}^{0}\tan\pars{\theta + \pi + a\ic}\,\dd\theta
\\[5mm] = &\
2\ic\,\Im\int_{0}^{\pi/2}\tan\pars{\theta + a\ic}\,\dd\theta =
\left.2\ic\,\Im\int_{\theta = 0}^{\theta = \pi/2}{%
\pars{z\expo{-\alpha} - \expo{\alpha}/z}/\pars{2\ic} \over \pars{z\expo{-\alpha} + \expo{\alpha}/z}/2}\,{\dd z \over \ic z}\,
\right\vert_{\ z\ =\ \exp\pars{\ic\theta}}
\\[5mm] = &\
\left.-2\ic\,\Im\int_{\theta = 0}^{\theta = \pi/2}{%
z^{2}\expo{-\alpha} - \expo{\alpha} \over z^{2}\expo{-\alpha} + \expo{\alpha}}\,{\dd z \over z}\,
\right\vert_{\ z = \exp\pars{\ic\theta}} =
2\ic\,\Im\lim_{\epsilon \to 0^{+}}\int_{\pi/2}^{0}\pars{-1}
{\epsilon\expo{\ic\theta}\ic\,\dd\theta \over \epsilon\expo{\ic\theta}}= \bbx{\ds{\pi\ic}}
\end{align}
