<s>[INST] Partial fraction decomposition $\frac{1}{(x-y)^2}\frac{1}{x^2}$ I want to integrate $$\frac{1}{(x-y)^2}\frac{1}{x^2}$$ with respect to $x$.
I know that I have to apply partial fraction decomposition but which ansatz do I have to make to arrive at
$$\frac{1}{(x-y)^2}\frac{1}{x^2}=-\frac{2}{y^3(x-y)}+\frac{1}{y^2(x-y)^2}+\frac{2}{y^3x}+\frac{1}{y^2x^2}$$
 [/INST] Here is the (comparatively) fast way to determine the partial fraction decomposition, using the poles of the fraction. To make the computation clearer, I'll denote  temporarily $y$ as  the constant $a$.
The decomposition has the form
$$\frac 1{x^2(x-a)^2}=\frac Ax+\frac B{x^2}+\frac C{x-a}+\frac D{(x-a)^2}.\tag 1$$
Multiplying both sides by $x^2(x-a)^2$, you obtain
$$1=Ax(x-a)^2+B(x-a)^2+Cx^2(x-a)+Dx^2.$$
Setting $x=0$ yields instantly $\;B=\dfrac1{a^2}$. Similarly, setting $x=a$ yields $D=\dfrac1{a^2}$.
To obtain the last two coefficients, multiply both sides of $(1)$ by $x$ and let $x\to\infty$: you obtain the relation $\:A+C=0$.
We need a last equation to determine $A$ & $C$. The best way seems to let $x=\frac a2$ (the arithmetic mean of the poles), which yields the relation
$$A-C=\frac 4{a^3},\quad\text{whence}\quad A=\frac 2{a^3},\enspace C=-\frac 2{a^3}.$$
Note:
If the fraction has a pole of higher order, it is generaly still faster to use division of polynomials by increasing degrees.
</s>