<s>[INST] Closed form for integral $\int_{0}^{\pi} \left[1 - r \cos\left(\phi\right)\right]^{-n} \phi \,{\rm d}\phi$ Is there a closed form for $$I_n =\int_{0}^{\pi} \frac{\phi}{(1 - r \cos\phi)^n} \,{\rm d}\phi $$ for $\left\vert\,r\,\right\vert < 1$ real and $n > 0$
integer ?
The solution to this integral would give a closed form solution for this integral, which describes the interaction energy of vector resonant relaxation in astrophysical dynamics.
Using Mathematica and analytic methods I have derived the following result for $n=\{1,2,3,4,5,6\}$: 
$$\tag{1} I_n = -\frac{a_n r}{s^{2n-2}} + \frac{b_n}{s^{2n-1}}\left[\chi_2(q) +\left(-\frac{c_n}{b_n}s + {\rm arctanh}(q) \right){\rm arctanh}(r) \right]$$
where $s=\sqrt{1-r^2}$, $q=\sqrt{(1-r)/(1+r)}$, $\chi_2(x)$ is the Legendre chi function, $a_n$, $b_n$, and $c_n$ are constants given by 
\begin{align}
a_1 &= 0, \quad b_1 = 4, \qquad c_1 = 0,\\
a_2 &= 0, \quad b_2 = 4, \qquad c_2 = 2,\\
a_3 &= 1, \quad b_3 = 4 + 2r^2, \qquad c_3 = 3,\\
a_4 &= \frac{7}{3}, \quad b_4 = 4 + 6r^2, \qquad c_4= \frac{11}{3} + \frac{4}{3}r^2,\\
a_5 &= \frac{23}{6}+\frac{11}{12}r^2, \quad b_5 = 4 + 12 r^2 + \frac{3}{2}r^4, 
\qquad c_5=\frac{25}{6} + \frac{55}{12}r^2,\\
a_6 &=\frac{163}{30} + \frac{47}{12}r^2, \quad b_6 = 4 + 20 r^2 + \frac{15}{2}r^4, 
\qquad c_6=\frac{137}{30} + \frac{607}{60}r^2 + \frac{16}{15}r^4.
\end{align}
Is the integral $I_n$ in the general closed form given by (1) for all $n$? If so, what are the constants $a_n$, $b_n$, and $c_n$?
 [/INST] First lets make the integral from $-\pi/2$ to $\pi/2$. Set $x = \phi-\pi/2$. We then get
$$I = \int_{-\pi/2}^{\pi/2}(1+r\sin(x))^{-n}(x+\pi/2)dx$$
Now recall that
$$(1+r\sin(x))^{-n} = \sum_{k=0}^{\infty} (-1)^k \dbinom{n+k}k r^k \sin^k(x)$$
Hence,
$$I = \sum_{k=0}^{\infty}(-r)^k \dbinom{n+k}k \int_{-\pi/2}^{\pi/2} (x+\pi/2)\sin^k(x)dx$$
Now from here, we can obtain
$$\int_{-\pi/2}^{\pi/2} \sin^k(x) dx \text{ and }\int_{-\pi/2}^{\pi/2} x\sin^k(x) dx$$ Lets call them $I_k$ and $J_k$ respectively. Hence,
$$I = \dfrac{\pi}2\sum_{k=0}^{\infty}r^{2k} \dbinom{n+2k}{2k} I_{2k} - \sum_{k=0}^{\infty}r^{2k+1} \dbinom{n+2k+1}{2k+1} J_{2k+1} \tag{$\star$}$$

Expression for $J_{2k+1}$ and convergence of the above summation:
We have
$$J_{2k+1} = -\int_{-\pi/2}^{\pi/2}x \sin^{2k}(x) d(\cos(x)) = \int_{-\pi/2}^{\pi/2} \cos(x) \sin^{2k}(x) dx + 2k \int_{-\pi/2}^{\pi/2} x \cos^2(x) \sin^{2k-1}(x) dx$$
$$\int_{-\pi/2}^{\pi/2} \cos(x) \sin^{2k}(x) dx = \int_{-1}^1 t^{2k} dt = \dfrac2{2k+1}$$
$$\int_{-\pi/2}^{\pi/2} x \cos^2(x) \sin^{2k-1}(x) dx = J_{2k-1} - J_{2k+1}$$
Hence,
$$(2k+1)J_{2k+1} = \dfrac2{2k+1} + 2k J_{2k-1}$$
Using this recurrence you can obtain $J_{2k+1}$. Also, it is easy to show that $\left \vert J_{2k+1} \right \vert \leq 2$ using induction.
Similarly, $I_{2k} = \dfrac1{4^k} \dbinom{2k}k \pi \leq \pi$.
Now, for $\vert r \vert < 1$, we have
$\displaystyle \sum_{k=0}^{\infty} \dbinom{n+2k}{2k} r^{2k}$ and $\displaystyle \sum_{k=0}^{\infty} \dbinom{n+2k+1}{2k+1} r^{2k}$ converges.
This ensures $\star$ makes perfect sense.
</s>