This is really straightforward from Chinese reminder theorem over $\Bbb Q[x]$. We have the congruences
$$P(x) = 1 \mod (x + 1)^3$$
$$P(x) = -1 \mod (x-1)^3$$
Note that $(x-1)^3$ and $(x+1)^3$ are relatively coprime, thus from Bezout's lemma it follows that there exists polynomials $a(x)$ and $b(x)$ such that
$$a(x)(x-1)^3 + b(x)(x+1)^3 = 1$$
Considering modulo $(x+1)^3$ and modulo $(x-1)^3$ respectively, we get that $a(x)$ is the inverse of $(x-1)^3$ modulo $(x+1)^3$ and $b(x)$ is of $(x+1)^3$ modulo $(x-1)^3$. The inverses produced by Euclidean algorithms are $-3/16x^2 - 9/16x - 1/2$ and $3/16x^2 - 9/16x + 1/2$, respectively, as verified below :
$$\left(\frac{-3}{16}x^2 - \frac9{16}x - \frac12\right)(x-1)^3 = -\frac3{16}x^5 + \frac{5}{8}x^3 - \frac{15}{16}x + \frac12 = 1 \mod (x+1)^3 $$
$$\left(\frac{3}{16}x^2 - \frac9{16}x + \frac12\right)(x+1)^3 = \frac3{16}x^5 - \frac5{8}x^3 + \frac{15}{16}x + \frac12 = 1 \mod (x-1)^3$$
Now applying Chinese remainder theorem gives
$$P(x) = a(x)(x-1)^3 + (-1)\cdot b(x)(x+1)^3 = -\frac{3}{8}x^5 + \frac{5}{4}x^3 - \frac{15}{8}x$$
This is our desired polynomial.