<s>[INST] What can the various ways of integrating $\int \frac { x ^2 }{ (x \sin (x) +\cos(x))^2} \, dx$ $$
  \int \frac {x^2}{(x\sin(x) + \cos(x))^2} \, \mathrm{d}x 
$$
Well I found a method for solving this sum in a book saying that : We can multiply and divide the expression by $x\cos(x)$ and then apply integration by parts.
*But that method/trick is quite difficult to spot when one gets the integral for the first time.Is there any alternative "easier to spot"/"more general"  technique to solve this integral?
 [/INST] $\bf{My\; Solution::}$  Let $$\displaystyle I = \int\frac{x^2}{(x\sin x+\cos x)^2}dx$$
We can write  
$$\displaystyle (x\sin x+\cos x) = \sqrt{1+x^2}\left\{\frac{x}{\sqrt{1+x^2}}\cdot \sin x+\frac{1}{\sqrt{1+x^2}}\cdot \cos x\right\} = \sqrt{1+x^2}\cdot \cos \left(x-\phi \right)$$
So Here $$\displaystyle \cos x\ \phi = \frac{1}{\sqrt{1+x^2}}$$ and $\displaystyle \sin \phi = \frac{x}{\sqrt{1+x^2}}$ and $\tan \phi = x\Rightarrow \phi = \tan^{-1}(x)$
So Integral
$$\displaystyle I = \int\frac{x^2}{(1+x^2)\cdot \cos^2(x-\phi)}dx = \int \sec^2 (x-\phi)\cdot \frac{x^2}{1+x^2} dx = \int \sec^2 (x-\tan^{-1}(x))\cdot \frac{x^2}{(1+x^2)}dx$$
Now Let $$\left(x-\tan^{-1}x\right) = t\;,$$ Then $\displaystyle \left(1-\frac{1}{1+x^2}\right)dx = dt\Rightarrow \frac{x^2}{1+x^2}dx = dt$
So $$\displaystyle I = \int \sec^2 t dt = \tan t +\mathcal {C} = \tan \left(x-\tan^{-1} x\right)+\mathcal{C} = \left(\frac{\tan x-x}{1+x\cdot \tan x}\right)+\mathcal{C}$$
So $$\displaystyle I = \int\frac{x^2}{(x\sin x+\cos x)^2}dx = \left(\frac{\sin x- x\cos x}{\cos x+x\sin x}\right)+\mathcal{C}$$
</s>