Answer
$$\frac{{{x^3}}}{3} + x - 2\ln \left| x \right| + \ln \left| {x + 1} \right| + 2\ln \left| {x - 1} \right| + C$$
Work Step by Step
$$\eqalign{
& \int {\frac{{{x^5} + {x^2} + 2}}{{{x^3} - x}}} dx \cr
& {\text{The integrand is an improper rational function since the numerator }} \cr
& {\text{has degree 5 and the denominator 3}}{\text{. Thus}}{\text{, using the long division}} \cr
& \,\,\,\,\,\,\frac{{{x^5} + {x^2} + 2}}{{{x^3} - x}} = {x^2} + 1 + \frac{{{x^2} + x + 2}}{{{x^3} - x}} \cr
& {\text{The integrand can be expressed as}} \cr
& \int {\left( {{x^2} + 1 + \frac{{{x^2} + x + 2}}{{{x^3} - x}}} \right)} dx \cr
& = \frac{{{x^3}}}{3} + x + \int {\frac{{{x^2} + x + 2}}{{{x^3} - x}}} dx \cr
& {\text{Decomposing the integrand into partial fractions}} \cr
& {\text{Factor the denominator}} \cr
& \frac{{{x^2} + x + 2}}{{{x^3} - x}} = \frac{{{x^2} + x + 2}}{{x\left( {x + 1} \right)\left( {x - 1} \right)}} \cr
& \frac{{{x^2} + x + 2}}{{x\left( {x + 1} \right)\left( {x - 1} \right)}} = \frac{A}{x} + \frac{B}{{x + 1}} + \frac{C}{{x - 1}} \cr
& {\text{Multiplying the equation by }}\left( {x - 2} \right)\left( {x - 1} \right){\text{, we have}} \cr
& {x^2} + x + 2 = A\left( {x + 1} \right)\left( {x - 1} \right) + Bx\left( {x - 1} \right) + Cx\left( {x + 1} \right) \cr
& {\text{if we set }}x = 0 \cr
& 2 = A\left( 1 \right)\left( { - 1} \right) + B\left( 0 \right) + C\left( 0 \right) \cr
& A = - 2 \cr
& {\text{if we set }}x = - 1 \cr
& 1 - 1 + 2 = A\left( 0 \right) + B\left( { - 1} \right)\left( { - 2} \right) + C\left( 0 \right) \cr
& 2 = B\left( 2 \right) \cr
& B = 1 \cr
& {\text{if we set }}x = 1 \cr
& 1 + 1 + 2 = A\left( 0 \right) + B\left( 0 \right) + C\left( 1 \right)\left( {1 + 1} \right) \cr
& 4 = C\left( 2 \right) \cr
& C = 2 \cr
& {\text{then}} \cr
& \frac{{{x^2} + x + 2}}{{x\left( {x + 1} \right)\left( {x - 1} \right)}} = \frac{{ - 2}}{x} + \frac{1}{{x + 1}} + \frac{2}{{x - 1}} \cr
& \cr
& \frac{{{x^3}}}{3} + x + \int {\frac{{{x^2} + x + 2}}{{{x^3} - x}}} dx = \frac{{{x^3}}}{3} + x + \int {\left( {\frac{{ - 2}}{x} + \frac{1}{{x + 1}} + \frac{2}{{x - 1}}} \right)} dx \cr
& {\text{Integrating}} \cr
& = \frac{{{x^3}}}{3} + x - 2\ln \left| x \right| + \ln \left| {x + 1} \right| + 2\ln \left| {x - 1} \right| + C \cr} $$