The given integrand is not a proper fraction.
Therefore, on dividing (x3+x+1) with x2−1, we get,
x3+x+1x2−1=x+2x+1x2−1
Let 2x+1x2−1=A(x+1)+B(x−1)
2x+1=A(x−1)+B(x+1)
On solving and equating the coefficients, we get,
A=12 and B=32
Therefore,
x3+x+1x2−1=x+12(x+1)+32(x−1)
∫x3+x+1x2−1dx=∫x dx+12∫1(x+1)dx+32∫1(x−1)dx
=x22+12log|x+1|+32log|x−1|+C