Answer
The required formula is $$\int \frac{1}{z^2}dz=-\frac{1}{z}+c.$$
Work Step by Step
The integral $$\int x \sec(x^2+1)\tan(x^2+1)dx=\int x\frac{\sin(x^2+1)}{\cos^2(x^2+1)}dx$$
with the substitution $t=x^2+1$ where is $dt=2xdx$ can be transformed into integral $$\frac{1}{2}\int \frac{\sin t}{\cos^2t}dt.$$
Finally with the substitution $z=\cos t$ we get integral $$-\frac{1}{2}\int\frac{1}{z^2}dz,$$
so the required formula is $$\int \frac{1}{z^2}dz=-\frac{1}{z}+c.$$