$\bf{Another\; Solution::}$ Let $$\displaystyle I = \int \frac{x^2}{(x\sin x+\cos x)^2}dx$$
Put $x=\tan \phi\;,$ Then $dx = \sec^2 \phi d\phi$
So Integral $$\displaystyle I = \int\frac{\tan^2 \phi \cdot \sec^2 \phi}{\left[\tan \phi\cdot \sin (\tan \phi)+\cos(\tan \phi)\vphantom{\frac11}\right]^2}d\phi $$
So $$\displaystyle I = \int\frac{\tan ^2\phi \cdot \sec^2 \phi\cdot \cos^2 \phi}{\left[\sin \phi\cdot \sin (\tan \phi)+\cos \phi\cos(\tan \phi)\vphantom{\frac11}\right]^2}d\phi$$
So we got $$\displaystyle I = \int\frac{\tan^2 \phi }{\left[\cos\left(\tan \phi-\phi\right)\vphantom{\frac11}\right]^2}d\phi$$
Now Put $(\tan\phi-\phi) = t\;,$ Then $(\sec^2 \phi-1)d\phi = dt\Rightarrow \tan^2 \phi d\phi = dt$
So Integral $$\displaystyle I = \int\frac{1}{\cos^2 t}dt = \int\sec^2t dt = \tan t+\mathcal{C}=\tan(\tan \phi-\phi)+\mathcal{C}$$
So Integral $$\displaystyle I = \tan (x-\tan^{-1}x)+\mathcal{C} = \frac{\tan x-x}{1+\tan x\cdot x}+\mathcal{C} = \left[\frac{\sin x-x\cdot \cos x}{\cos x+x\cdot \sin x}\vphantom{\frac11}\right]+\mathcal{C}$$