\(P=\dfrac{-x^4+2x^3-2x+1}{4x^2-1}+\dfrac{8x^2-4x+2}{8x^3+1}\)
\(=\dfrac{\left(1-x^2\right)\left(1+x^2\right)+2x\left(x^2-1\right)}{4x^2-1}+\dfrac{2\left(4x^2-2x+1\right)}{\left(2x+1\right)\left(4x^2-2x+1\right)}\)
\(=\dfrac{\left(1-x^2\right)\left(1+x^2-2x\right)}{4x^2-1}+\dfrac{2}{2x+1}\)
\(=\dfrac{\left(1-x^2\right)\left(x^2-2x+1\right)+4x-2}{4x^2-1}\)