You need to convert the denominator to the form `x^2+a^2` , hence, you need to complete the square using the formula `(a+b)^2 = a^2 + 2ab + b^2` , such that:

`x^2 + x = a^2 + 2ab =gt {(x^2=a^2 =gt x=a),(x = 2xb =gt b = 1/2):}`

`x^2 + x + (1/2)^2 - (1/2)^2 +2= (x + 1/2)^2 - 1/4 + 2 `

`x^2 + x + (1/2)^2 - (1/2)^2 +2 = (x + 1/2)^2 + 7/4`

You need to use the following substitution such that:

`x+1/2 = t => x = t- 1/2 => dx = dt`

Changing the variable to integrand yields:

`int (3x^2+1)/((x^2+x+2)^3)dx = int (3(t-1/2)^2+1)/((t^2+7/4)^3)dt`

You need to solve the integral `int (3(t-1/2)^2+1)/((t^2+7/4)^3)d` t using partil fraction decomposition such that:

`(3(t-1/2)^2+1)/((t^2+7/4)^3) = (At + B)/(t^2+7/4) + (Ct+D)/((t^2+7/4)^2) + (Et+F)/((t^2+7/4)^3)`

`3t^2 - 3t + 3/4 + 1 = (At + B)((t^2+7/4)^2) + (Ct+D)(t^2+7/4) + (Et+F)`

`3t^2 - 3t + 7/4 = (At + B)(t^4 + 7/2t^2 + 49/16) + Ct^3 + 7/4Ct + Dt^2 + 7/4D + Et + F`

`3t^2 - 3t + 7/4 = At^5 + 7/2At^3 + 49/16At + Bt^4 + 7/2Bt^2 + 49/16B+ Ct^3 + 7/4Ct + Dt^2 + 7/4D + Et + F`

`3t^2 - 3t + 7/4 = At^5 + Bt^4 + t^3(7/2A + C) + t^2(7/2B + D) + t(49/16A + 7/4C + E) + 49/16B + 7/4D + F`

Equating the coefficients of like powers yields:

`A =0 `

`B = 0`

`7/2A + C = 0 => C = 0`

`7/2B + D = 3 => D = 3`

`49/16A + 7/4C + E = -3 => E = -3`

`49/16B + 7/4D + F = 7/4 => F = 7/4 - 21/4 => F = -14/4`

`(3(t-1/2)^2+1)/((t^2+7/4)^3) = 3/((t^2+7/4)^2) + (-3t-14/4)/((t^2+7/4)^3)`

Integrating both sides yields:

`int (3(t-1/2)^2+1)/((t^2+7/4)^3) dt= int 3/((t^2+7/4)^2) dt+ int (-3t-14/4)/((t^2+7/4)^3) dt`

You need to use the substitution `tan u = t => 1/(cos^2 u)du = dt`

`int 3/((t^2+7/4)^2) dt = int 3/((tan^2 u + 7/4)^2)*1/(cos^2u)du` =`int 3/(1/(cos^2 u) + 3/4)*1/(cos^2 u)du`

`int (12cos^2 u)/(4+3cos^2 u)*1/(cos^2 u) du` `=12 int 1/(4+3cos^2 u)du`

`12 int 1/(4+3cos^2 u)du = (6sqrt7arctan(2sqrt7/7)tan u)/7 + c`

You need to use partial fraction decomposition to solve `(16(14+12t))/((7+4t^2)^3)` `192t + 224= At^5 + Bt^4 + t^3(7/2A + C) + t^2(7/2B + D) + t(49/16A + 7/4C + E) + 49/16B + 7/4D + F`

`49/16A + 7/4C + E = 192 => E = 12`

`F = 224/16 = 14`

`int (Et+F)/((t^2+7/4)^3)dt = int (12t+14)/((t^2+7/4)^3)dt`

`int (Et+F)/((t^2+7/4)^3)dt = (2/49)(3sqrt7 arctan((2sqrt7t)/7) + 14(12t^3+35t-21)/(7+4t^2)^2) + c`

Hence, evaluating the given integral yields `int (3x^2+1)/((x^2+x+2)^3)dx = (6sqrt7arctan(2sqrt7/7)tan (arctan(x+1/2)))/7 - (2/49)(3sqrt7 arctan((2sqrt7(x+1/2))/7) + 14(12(x+1/2)^3+35(x+1/2)-21)/(7+4(x+1/2)^2)^2) + c.`