This integral: $\int\left( \frac{x^2}{1+x^2} \right)\frac{1+x\tan(x)+ \tan(x)-x}{1 +x\tan(x)-\tan(x)+x}dx$ seems to be complicated, but it can be easily solved if one know the formula: $$\tan(a+b+c)= \frac{\tan(a)+ \tan(b)+ \tan(c ) - \tan(a) \tan(b)\tan(c)}{1-\tan(a)\tan(b)-\tan(a)\tan(c)-\tan(b)\tan(c)}$$. so $$\int\left( \frac{x^2}{1+x^2} \right)\frac{1+x\tan(x)+ \tan(x)-x}{1 +x\tan(x)-\tan(x)+x}dx = \int\left( \frac{x^2}{1+x^2} \right)\tan(x+\frac \pi 4 - \arctan(x))dx$$ and this is a straight forward $u$ sub. "There is no way anyone can see that if they didn't know this problem before" that was my reaction but one of my friends who is known for being smart solved this in less than a minute!
The question is How one can notice a generalisation of famous formulas ? by generalisation I mean a formula known based on 2 variables extended to more variables as in my example .there are ton of these question that uses some generalisation of famous formulas like $(a+b+c)^n$ The question is how one should notice them ? Do people memorise extended formulas like $\sin(a+b+c) $? or do they have to be so smart to notice them ? Is there is a way one can notice these ?