Let $S=\{-ia, ia\}$, let $ \varphi \colon \Bbb C\setminus S\to \Bbb C, z\mapsto\dfrac{e^{i(3z)}}{(z^2+a^2)^2}$.
Given $n\in \Bbb N$ such that $n> a$, define $\gamma (n):=\gamma _1(n)\lor \gamma _2(n)$ with $\gamma _1(n)\colon [-n,n]\to \Bbb C, t\mapsto t$ and $\gamma _2(n)\colon [0,\pi]\to \Bbb C, \theta \mapsto ne^{i\theta}$, ($\gamma (n)$ is an upper semicircle).
Observe that $S$ is the set of singularities of $\varphi$ and both of them are second order poles.
Therefore $$\operatorname {Res}(\varphi ,ia)=\left.\dfrac{d}{dz}\left(z\mapsto (z-ia)^2\varphi (z)\right)\right\vert_{z=ia}\overset{\text{W.A.}}{=}\left.\dfrac{ie^{i3z}(3ia+3z+2i)}{(z+ia)^3}\right\vert_{z=ia} = \dfrac{e^{-3a}(3a+1)}{4a^3i}.$$
Here is the link for the equality $\text {W.A.}$.
Quick considerations about winding numbers, inside and outside region of $\gamma(n)$, the fact that $n>a$, the fact that $\varphi$ is holomorphic and the residue theorem yield $$\displaystyle \int \limits_{\gamma (n)}\varphi (z)dz=2\pi i\cdot \dfrac{e^{-3a}(3a+1)}{4a^3i}= \dfrac{\pi e~^{-3a}(3a+1)}{2a^3}.$$
On the other hand $\displaystyle \int \limits _{\gamma (n)}\varphi=\int \limits _{\gamma _1(n)}\varphi +\int \limits_{\gamma _2(n)}\varphi \tag {*}$
Note that $$\displaystyle\int \limits _{\gamma _1(n)}\varphi(z)dz=\int \limits _{-n}^n\varphi (t)dt=\int \limits_{-n}^n\dfrac{e^{i(3t)}}{(t^2+a^2)^2}dt=\int \limits_{-n}^n\dfrac{\cos(3t)+i\sin 3t)}{(t^2+a^2)^2}dt=\int \limits _{-n}^n\dfrac{\cos (3t)}{(t^2+a^2)^2}dt.$$
The last equality is due to $t\mapsto \dfrac{\sin (3t)}{(t^2+a^2)^2}$ being an odd function and due to the integral being computed on a symmetric interval.
Furthermore, $$\int \limits _{\gamma _2(n)}\varphi (z)dz=\int \limits _0^\pi \varphi(ne^{i\theta})\cdot ine^{i\theta}d\theta=\int \limits _0^\pi\dfrac{e^{i\cdot 3ne^{i\theta}}ine^{i\theta}}{(n^2e^{2ni\theta }+a^2)^2}d\theta=n\int \limits _0^\pi i\dfrac{e^{i\cdot 3n(\cos (\theta)+i\sin (\theta))}e^{i\theta}}{(n^2e^{2ni\theta }+a^2)^2}d\theta=\\
=n\int \limits _0^\pi i\dfrac{e^{-3n\sin (\theta)}e^{i(3n\cos (\theta)+\theta)}}{(n^2e^{2ni\theta }+a^2)^2}d\theta,$$
from where one gets $$\left \vert\, \int \limits _{\gamma _2(n)}\varphi (z)dz\right \vert\leq n\int \limits _0^\pi \left \vert i\dfrac{e^{-3n\sin (\theta)}e^{i(3n\cos (\theta)+\theta)}}{(n^2e^{2ni\theta }+a^2)^2}\right \vert d\theta =n\int \limits_0^\pi \left \vert\dfrac{e^{-3n\sin (\theta)}}{(n^2e^{2ni\theta }+a^2)^2}\right \vert d\theta=\\=n\int \limits_0^\pi \dfrac{\left \vert e^{-3n\sin (\theta)}\right \vert}{\left \vert n^2e^{2ni\theta }+a^2\right \vert^2}d\theta \underset{(n>a)}{\leq} n\int \limits _0^\pi \dfrac{e^{-3a\sin (\theta)}}{(n^2-a^2)^2}d\theta=\dfrac{n}{(n^2-a^2)^2}\int \limits _0^\pi e^{-3a\sin (\theta)}d\theta\overset{n\to +\infty}{\longrightarrow} 0$$
Taking the limit in $(*)$ one finally gets $$\dfrac{\pi e~^{-3a}(3a+1)}{2a^3}=\int \limits_{-\infty}^{+\infty} \dfrac{\cos (3t)}{(t^2+a^2)^2}dt.$$
Due to the evenness of $t\to \dfrac{\cos (3t)}{(t^2+a^2)^2}$ it follows that $\displaystyle \int \limits_{0}^{+\infty} \dfrac{\cos (3t)}{(t^2+a^2)^2}dt=\dfrac{\pi e~^{-3a}(3a+1)}{4a^3}$ which agrees with WA.
I regret having started this.