Consider $\frac{x^{2}}{\left(x^{2}+1\right)\left(x^{2}+4\right)}$ and put $x^{2}=y$.
Then $\frac{x^{2}}{\left(x^{2}+1\right)\left(x^{2}+4\right)}=\frac{y}{(y+1)(y+4)}$.
Using partial fractions,write $\frac{y}{(y+1)(y+4)} = \frac{A}{y+1} + \frac{B}{y+4}$.
This implies $y = A(y+4) + B(y+1)$.
Comparing coefficients of $y$ and constant terms,we get $A+B=1$ and $4A+B=0$.
Solving these,we find $A = -\frac{1}{3}$ and $B = \frac{4}{3}$.
Thus,$\frac{x^{2}}{\left(x^{2}+1\right)\left(x^{2}+4\right)} = -\frac{1}{3(x^{2}+1)} + \frac{4}{3(x^{2}+4)}$.
Integrating both sides,$\int \frac{x^{2} dx}{(x^{2}+1)(x^{2}+4)} = -\frac{1}{3} \int \frac{dx}{x^{2}+1} + \frac{4}{3} \int \frac{dx}{x^{2}+4}$.
Using the standard integral $\int \frac{dx}{x^{2}+a^{2}} = \frac{1}{a} \tan^{-1}(\frac{x}{a}) + C$,we get:
$= -\frac{1}{3} \tan^{-1}(x) + \frac{4}{3} \times \frac{1}{2} \tan^{-1}(\frac{x}{2}) + C$.
$= -\frac{1}{3} \tan^{-1}(x) + \frac{2}{3} \tan^{-1}(\frac{x}{2}) + C$.