Integrate: $\int \frac{x}{\left(x^2-4x-13\right)^2}dx$. 
Integrate:
$$\int \frac{x}{\left(x^2-4x-13\right)^2}dx$$

Here's my attempt:
I first completed the squares for the denominator:
$$\left(x^2-4x-13\right)^2=(x-2)^2-17 \implies \int \frac{x}{\left(\left(x-2\right)^2-17\right)^2}dx$$
I then used $u$-subsituition:
$$u=x-2 \implies \int \frac{u+2}{\left(u^2-17\right)^2}du = \int \frac{u}{\left(u^2-17\right)^2}du+\int \frac{2}{\left(u^2-17\right)^2}du$$
The first part of the new integral is quite simple:
$$\int \frac{u}{\left(u^2-17\right)^2}du=\frac{-1}{2(u^2-17)}$$
Then I did the second part:
$$\int \frac{2}{\left(u^2-17\right)^2}du = -\frac{1}{2\left(u^2-17\right)}+2\left(\frac{1}{68\sqrt{17}}\ln \left|u+\sqrt{17}\right|-\frac{1}{68\left(u+\sqrt{17}\right)}-\frac{1}{68\sqrt{17}}\ln \left|u-\sqrt{17}\right|-\frac{1}{68\left(u-\sqrt{17}\right)}\right) = -\frac{1}{2\left(\left(x-2\right)^2-17\right)}+2\left(\frac{1}{68\sqrt{17}}\ln \left|x-2+\sqrt{17}\right|-\frac{1}{68\left(x-2+\sqrt{17}\right)}-\frac{1}{68\sqrt{17}}\ln \left|x-2-\sqrt{17}\right|-\frac{1}{68\left(x-2-\sqrt{17}\right)}\right) = -\frac{1}{2\left(x^2-4x-13\right)}+2\left(\frac{1}{68\sqrt{17}}\ln \left|x-2+\sqrt{17}\right|-\frac{1}{68\left(x-2+\sqrt{17}\right)}-\frac{1}{68\sqrt{17}}\ln \left|x-2-\sqrt{17}\right|-\frac{1}{68\left(x-2-\sqrt{17}\right)}\right) + C, C \in \mathbb{R}$$
Is this working out correct? I'm not really sure how WolframAlpha works, so I didn't check it on there.

Making the problem more general
$$I=\int \frac x {(x^2+ax+b)^2}\,dx \qquad \text{with} \qquad a^2-4b \neq 0$$ Let $r$ and $s$ be the roots of the quadratic (whatever they could be - real or complex) to make
$$ \frac x {(x^2+ax+b)^2}= \frac x {(x-r)^2 \, (x-s)^2}$$ Using partial fraction decomposition
$$ \frac x {(x-r)^2 \, (x-s)^2}=\frac{r+s}{(r-s)^3}\left(\frac 1{x-s}-\frac 1{x-r} \right)+\frac 1{(r-s)^2 }\left(\frac{r}{(x-r)^2}+\frac{s}{(x-s)^2}\right)$$ The first part is simple. For the second piece, you have two integrals
$$J_k=\int \frac k {(x-k)^2}\,dx=\int \frac {dy}{(y-1)^2}=-\frac 1{y-1}=-\frac{k}{x-k}$$ Just combine all the pieces and, at the end, replace $r$ and $s$ by their values.
