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$?
 A: 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.
A: The integral can be evaluated by realizing that it is a derivative with respect to $R=1/r$, i.e.
$$I_n =\int_{0}^{\pi} \frac{\phi}{(1 - r \cos\phi)^n} \,{\rm d}\phi = R^n \int_{0}^{\pi} \frac{\phi}{(R - \cos\phi)^n} \,{\rm d}\phi = \frac{(-1)^{n-1} R^n}{(n-1)!} \frac{d^{n-1}}{dR^{n-1}}\int_{0}^{\pi} \frac{\phi}{R - \cos\phi} \,{\rm d}\phi. $$
This integral can be evaluated with a Weierstrass substitution $t = \tan (\phi/2)$, 
$$F(R) = \int_{0}^{\pi} \frac{\phi}{R - \cos\phi} \,{\rm d}\phi 
= \frac{4r}{1+r}\int_0^{\infty} \frac{\arctan t}{q^2 + t^2} dt
= \frac{4}{\sqrt{R^2-1}}\int_0^{\pi/2} \arctan \left(q \tan y \right) dy
=  \frac{4}{\sqrt{R^2-1}}\left[\chi_2(q) - {\rm arctanh}(q) \ln(q) \right]
=\frac{4}{\sqrt{R^2-1}}\left[\chi_2(q) +\frac{1}{2} {\rm arccosh}(R) {\rm arctanh}(R) \right],$$
where $q=\sqrt{(1-r)/(1+r)}$ and $\chi_2(x)$ is the Legendre chi function. We can now derive the integral by taking derivatives of this function
$$I_n =  \frac{(-1)^{n-1} R^n}{(n-1)!} \frac{d^{n-1}}{dR^{n-1}}F(R).$$
Note that ${\rm arccosh\,}R=2{\rm arctanh\,}q$, ${\rm arccoth\,}R=\ln q$, and
$$\frac{d}{dx}\chi_2(x) = \frac{{\rm arctanh}(x)}{x} \quad{\rm so\quad} \frac{d}{dR}\chi_2(q) = \frac{{\rm arctanh}(q)}{R^2 - 1} = \frac{1}{2}\frac{{\rm arccosh}(R)}{R^2 - 1} $$
$$\frac{d}{dR} {\rm arccosh}(R) = \frac{1}{\sqrt{R^2 - 1}}  \quad{\rm and\quad} \frac{d}{dR} {\rm arccoth}(R) = \frac{-1}{R^2 - 1} 
= \frac{1}{2}\left(\frac{1}{R+1} - \frac{1}{R-1}\right).$$
The derivatives for $n\geq 3$ simplify to
$$I_n = \frac{R^n}{S^{2n-2}}\left\{ \frac{4 A_{n-1}}{S}\left[\chi_2(q) - {\rm arctanh(q)\ln q}\right]\right. \\
\left.+2\sum_{k=0}^{n-2} \frac{A_k A_{n-k-2}}{k+1} \ln q
+ \sum_{j=0}^{n-3}\sum_{k=0}^{n-3-j}\frac{A_k A_{n-3-j-k}}{n-1-k} \frac{(R-1)^{1+j}-(R+1)^{1+j}}{1+j}
 \right\} $$
where $S=\sqrt{R^2-1}$ and $A_n$ is a polynomial of $R$ defined as
$$A_n = \frac{(-1)^n}{n!}\left(R^2-1\right)^{n+(1/2)}\frac{d^{n}}{dR^{n}} \left(R^2-1\right)^{-1/2}\\
=\left(\frac{R+1}{4}\right)^n\sum_{s=0}^{n}\frac{(2s)!}{(s!)^2}\frac{[2(n-s)]!}{[(n-s)!]^2}q^{2s}.$$ 
The coefficients are related to Legendre polynomials $P_{2n}(0)=(-1)^n(2n)!/[4^n (n!)^2]$.
The result simplifies to
$$
I_n=\left(\frac{R}{R-1}\right)^n \frac{q^2}{4^{n-2}}\left\{
a(q) [\chi_2(q) - {\rm arctanh(q)}\ln q]
+b(q)\ln q + c(q)\right\}$$
where
$$
a(q)=\sum_{K=0}^{n-1}q^{2K-1}
\frac{(2K)!}{(K!)^2} \frac{[2(n-1-K)]!}{[(n-1-K)!]^2}\,,
$$
$$
b(q)=\sum_{K=0}^{n-2}q^{2K}
\sum_{s=0}^{K}\frac{(2s)!}{(s!)^2}\frac{[2(K-s)]!}{[(K-s)!]^2}
\sum_{j=K}^{n-2}\frac{[2(j-K)]!}{[(j-K)!])^2}\frac{[2(n-2-j)]!}{[(n-2-j)!]^2}\frac{2}{j-s+1}\,,
$$
$$
c(q)=\sum_{K=0}^{n-3}q^{2K+2}
\sum_{J=0}^{K} \frac{4^{K-J+1}}{1+K-J} \sum_{s=0}^{J}\frac{(2s)!}{(s!)^2}\frac{[2(J-s)]!}{[(J-s)!]^2}\\
\quad\times
\sum_{j=K}^{n-3}\frac{[2(j-K)]!}{[(j-K)!])^2}\frac{[2(n-3-j)]!}{[(n-3-j)!]^2}\frac{1}{n-1-j+s+K-J}\\
\quad+\sum_{K=0}^{n-3}q^{2K}
\sum_{J=K}^{L-3} \frac{-4^{J-K+1}}{1+J-K}\sum_{s=0}^{K}\frac{(2s)!}{(s!)^2}\frac{[2(K-s)]!}{[(K-s)!]^2}\\
\quad\times
\sum_{j=J}^{n-3}\frac{[2(j-J)]!}{[(j-J)!])^2}\frac{[2(n-3-j)]!}{[(n-3-j)!]^2}\frac{1}{n-1-j+s+J-K}\,.$$
A: Not a full answer, but maybe interesting:
$I_{n}(r)$ obeys a recursion relation:
$$
I_{n+1}(r)=I_{n}(r)+\frac{r}{n} \frac{\partial}{\partial r}I_{n}(r)
$$
A large $n$ approximation is:
$$
I_{n}(r)\stackrel{n \rightarrow \infty}{\sim} \int_{0}^{\pi}\phi \exp(n\, r \cos \phi)\mathrm{d}\phi,
$$
which shows that for large $n$ the integral depends only on the product $n\,r$. Interestingly, also the approximation seems not to be solvable in closed form.
For the approximation I used:
$$
\left(1 - \frac{z}{n}\right)^{n} \stackrel{n \rightarrow \infty}{\sim} e^{- z}
$$
