There are two ways to show that both are anti-derivatives of he same functions.
The first way is to differentiate both of them and see if you get the same result.
The second is to show that the difference of you two solutions is a constant.
Each way has its own merit and sometimes one is easier to check than the other.
I prefer the first method because I also make sure that my answer is correct by comparing the derivatives with the original integrand for accuracy.
My approach:
Let
$$I(t) = \int_{0}^{\infty} \frac{xt - \sin(xt)}{x^3\left(x^2 + 4\right)} \:dx$$
Where $I = I(1)$
Taking the first derivative:
$$ \frac{dI}{dt} = \int_{0}^{\infty} \frac{x - x\cos(xt)}{x^3\left(x^2 + 4\right)} \:dx = \int_{0}^{\infty} \frac{1 - \cos(xt)}{x^2\left(x^2 + 4\right)} \:dx$$
Taking the second derivative:
$$ \frac{d^2I}{dt^2} = \int_{0}^{\infty} \frac{x\sin(xt)}{x^2\left(x^2 + 4\right)} \:dx = \int_{0}^{\infty} \frac{\sin(xt)}{x\left(x^2 + 4\right)} \:dx$$
Now, take the Laplace Transform w.r.t $t$:
\begin{align}
\mathscr{L}\left[ \frac{d^2I}{dt^2}\right] &= \int_{0}^{\infty} \frac{\mathscr{L}\left[\sin(xt)\right]}{x\left(x^2 + 4\right)} \:dx \\
&= \int_{0}^{\infty} \frac{x}{\left(s^2 + x^2\right)x\left(x^2 + 4\right)}\:dx \\
&= \int_{0}^{\infty} \frac{1}{\left(s^2 + x^2\right)\left(x^2 + 4\right)}\:dx
\end{align}
Applying the Partial Fraction Decomposition we may find the integral
\begin{align}
\mathscr{L}\left[ \frac{d^2I}{dt^2}\right] &= \int_{0}^{\infty} \frac{1}{\left(s^2 + x^2\right)\left(x^2 + 4\right)}\:dx \\
&= \frac{1}{s^2 - 4} \int_{0}^{\infty} \left[\frac{1}{x^2 + 4} - \frac{1}{x^2 + s^2} \right]\:dx \\
&= \frac{1}{s^2 - 4} \left[\frac{1}{2}\arctan\left(\frac{x}{2}\right) - \frac{1}{s}\arctan\left(\frac{x}{s}\right)\right]_{0}^{\infty} \\
&= \frac{1}{s^2 - 4} \left[\frac{1}{2}\frac{\pi}{2} - \frac{1}{s}\frac{\pi}{2} \right] \\
&= \frac{\pi}{4s\left(s + 2\right)}
\end{align}
We now take the inverse Laplace Transform:
$$ \frac{d^2I}{dt^2} = \mathscr{L}^{-1}\left[\frac{\pi}{4s\left(s + 2\right)} \right] = \frac{\pi}{8}\left(1 - e^{-2t} \right) $$
We now integrate with respect to $t$:
$$ \frac{dI}{dt} = \int \frac{\pi}{8}\left(1 - e^{-2t} \right)\:dt = \frac{\pi}{8}\left(t + \frac{e^{-2t}}{2} \right) + C_1$$
Now
$$ \frac{dI}{dt}(0) = \int_{0}^{\infty} \frac{1 - \cos(x\cdot 0)}{x^2\left(x^2 + 4\right)} \:dx = 0 = \frac{\pi}{8}\left(\frac{1}{2} \right) + C_1 \rightarrow C_1 = -\frac{\pi}{16}$$
Thus,
$$ \frac{dI}{dt} = \int \frac{\pi}{8}\left(1 - e^{-2t} \right)\:dt = \frac{\pi}{8}\left(t + \frac{e^{-2t}}{2} \right) - \frac{\pi}{16}$$
We now integrate again w.r.t $t$
$$ I(t) = \int \left[\frac{\pi}{8}\left(t + \frac{e^{-2t}}{2} \right) - \frac{\pi}{16} \right] \:dt = \frac{\pi}{8}\left(\frac{t^2}{2} - \frac{e^{-2t}}{4} \right) - \frac{\pi}{16}t + C_2 $$
Now
$$I(0) = \int_{0}^{\infty} \frac{x\cdot0 - \sin(x\cdot0)}{x^3\left(x^2 + 4\right)} \:dx = 0 = \frac{\pi}{8}\left( -\frac{1}{4} \right) + C_2 \rightarrow C_2 = \frac{\pi}{32}$$
And so we arrive at our expression for $I(t)$
$$I(t)= \frac{\pi}{8}\left(\frac{t^2}{2} - \frac{e^{-2t}}{4} \right) - \frac{\pi}{16}t + \frac{\pi}{32}$$
Thus,
$$I = I(1) = \frac{\pi}{8}\left(\frac{1}{2} - \frac{e^{-2}}{4} \right) - \frac{\pi}{16} + \frac{\pi}{32} = \frac{\pi}{32}\left(1 - e^{-2}\right)$$
Best Answer
\begin{align}I(x)&=\int_{0}^{\frac{\pi}{2}}{\frac{du}{x^2\cos^2u+\sin^2u}}\,du\\ &=\int_{0}^{\frac{\pi}{2}}{\frac{du}{x^2+\tan^2u}}\times \dfrac{1}{\cos^2 u}\,du\\ \end{align}
The function is not defined for $x=0$.
Observe that, $I(-x)=I(x)$
Perform the change of variable $y=\tan u$,and $x>0$ \begin{align}I(x)&=\int_{0}^{\infty}{\frac{du}{x^2+u^2}}\,\\ &=\left[\dfrac{1}{x}\arctan\left(\dfrac{u}{x}\right)\right]_0^{\infty}\\ &=\dfrac{\pi}{2x} \end{align} Therefore, For $x\neq 0$, $\boxed{I(x)=\dfrac{\pi}{2\left|x\right|}}$