How to compute
$$\int \limits _0 ^{2 \pi} \frac {(r \cos \phi +x) \cos n\phi} {r^2+2xr \cos \phi +x^2} d\phi ?$$
The answer I am provided with is $\dfrac {(-1)^n\pi r^n} {x^{n+1}}$ for $\ x>r$, but I have no idea whether this is actually correct and how to get this.
If I may add my two cents. A 'real' method to consider.
There are many Poisson-like series identities. A 'family' if you will.
One of those sums that can be derived from the geometric series:
$$\sum_{n=0}^{\infty}\frac{(-1)^{n}r^{n}}{x^{n+1}}\cos(n\theta)=\Re\left(\frac{1}{x}\cdot \frac{1}{1+\frac{re^{i\theta}}{x}}\right)=\frac{x+r\cos(\theta)}{r^{2}+2rx\cos(\theta)+x^{2}}, \;\ r<x$$
EDIT:
Something I just thought of that may be another approach.
If we instead find, by whatever means (residues is a good approach, of course), $$\int_{0}^{2\pi}\frac{\cos(n\theta)}{r^{2}+2xr\cos(\theta)+x^{2}}d\theta=\frac{2(-1)^{n}\pi r^{n}}{x^{n}(x^{2}-r^{2})}**$$
then use it with the identity:
$$\frac{2x\cos(n\theta)}{x^{2}-r^{2}}\left(\frac{x+r\cos(\theta)}{r^{2}+2rx\cos(\theta)+x^{2}}-\frac{1}{2x}\right)=\frac{\cos(n\theta)}{r^{2}+2rx\cos(\theta)+x^{2}}$$
Expand and integrate both sides:
$$\frac{2x}{x^{2}-r^{2}}\int_{0}^{2\pi}\frac{(x+r\cos(\theta))\cos(n\theta)}{r^{2}+2rx\cos(\theta)+x^{2}}d\theta-\frac{1}{x^{2}-r^{2}}\int_{0}^{2\pi}\cos(n\theta)d\theta=\frac{2(-1)^{n}\pi r^{n}}{x^{n}(x^{2}-r^{2})}$$
The rightmost integral with just the cos term evaluates to 0. Multiply by $\frac{x^{2}-r^{2}}{2x}$ and obtain:
$$\int_{0}^{2\pi}\frac{(x+r\cos(\theta))\cos(n\theta)}{r^{2}+2rx\cos(\theta)+x^{2}}d\theta=\frac{2(-1)^{n}\pi r^{n}}{x^{n}(r^{2}-x^{2})}\cdot \frac{r^{2}-x^{2}}{2x}=\frac{(-1)^{n}\pi r^{n}}{x^{n+1}}$$
Please excuse any typos and let me know of them. Really easy in all that :)
** one way is to consider $$f(z)=\frac{z^{n}}{(1-rz)(1-r/z)}$$ and note the residue at $z=r$. Then, do some manipulating by letting $r\to -r/x$.
Ergo, the residue at $z=r$ is $\frac{r^{n}}{1-r^{2}}$.
Thus, $$\int_{0}^{2\pi}\frac{\cos(n\theta)}{1-2r\cos*\theta)+r^{2}}d\theta=\frac{2\pi r^{n}}{1-r^{2}}$$
Let $r\to -r/x$ and obtain:
$$\int_{0}^{2\pi}\frac{x^{2}\cos(n\theta)}{x^{2}+2rx\cos(\theta)+r^{2}}d\theta=\frac{2\pi\cdot x^{2}(-1)^{n}r^{n}}{x^{n}(x^{2}-r^{2})}$$.
Multiply by $1/x^{2}$:
$$\int_{0}^{2\pi}\frac{\cos(n\theta)}{x^{2}+2rx\cos(\theta)+r^{2}}d\theta=\frac{2\pi (-1)^{n}r^{n}}{x^{n}(x^{2}-r^{2})}$$
From above, multiplying by the $\frac{x^{2}-r^{2}}{2x}$ gives the result needed.