I tried to solve this integral on Brilliant earlier using an identity for improper integrals, but it turned out to be wrong. I did some research and found that this identity only works when our function has a "bounded anti-derivative" on our interval. Here is the integral in question:
$$\int_0^\infty \frac1x \arctan\left(\frac{3x^2}{4x^4+5x^2+2}\right) \mathrm dx$$
Here is where I found this identity: https://brilliant.org/wiki/integration-tricks/
Scroll down to where it says "Inversions" to find it.
The question I had was why you had to have a bounded anti-derivative in order to make the substitution? I understand that the answer I received from doing this doesn't make sense (as I got the integral diverges), but I don't understand why. Could anyone shed some light on this?