How to integrate this indefinite integral? $$\int\frac{x^2\sec^2x}{(x \tan{x}+1)^{2}}\,\mathrm{d}x$$
I tried the online available calculators but they cannot calculate the answer or provide the solution.

This is basically working backwards, like @Arthur suggests:
\begin{align}
\frac{x^2\sec^2 x}{(x\tan x+1)^2} &= \frac{x^2}{\left(x\frac{\sin x}{\cos x} + 1\right)^2\cos^2 x}\\
&= \frac{x^2}{(x\sin x + \cos x)^2}\\
&= \frac{x^2(\sin^2 x + \cos ^2 x) - x\cos x\sin x + x \cos x\sin x}{(x\sin x + \cos x)^2}\\
&= \frac{x\sin x(x \sin x + \cos x) - (\sin x - x\cos x)x\cos x}{(x\sin x + \cos x)^2}\\
&= \frac{(\sin x - x\cos x)'(x \sin x + \cos x) - (\sin x - x\cos x)(x\sin x + \cos x)'}{(x\sin x + \cos x)^2}\\
&= \left(\frac{\sin x - x\cos x}{x \sin x + \cos x}\right)'
\end{align}
so $$\int \frac{x^2\sec^2 x}{(x\tan x+1)^2} \,dx = \frac{\sin x - x\cos x}{x \sin x + \cos x}$$
