# Sum involving incomplete beta functions

I am interested in the evaluation (A), or at least an asymptotic expansion for large $$N$$ (B), of the following finite sum $$\begin{equation}\begin{split} S^{(p)}(N)&\equiv2N\sum_{k=1}^{\left\lfloor\frac{N-1}{2}\right\rfloor}\left[\left(1-\frac{k}{N}+\frac{1}{2N}\right)^{N+p}B\left(\frac{1-\frac{2k}{N}}{1-\frac{k}{N}+\frac{1}{2N}};N,p+1\right)\right.\\[8pt] &\left.\quad-\frac{(1+\frac{1}{N})^{N+p}}{2^p}B\left(\frac{1-\frac{2k}{N}}{1+\frac{1}{N}};N,p+1\right)\right], \end{split}\end{equation}$$ where $$N\in\mathbb{N}$$, $$p>0$$ and $$B(x;a,b)$$ is the incomplete beta function $$B(x;a,b):=\int_0^xx^{a-1}(1-x)^{b-1}\,\text{d}x.$$

(A) So far I have elaborated the above expression in the following way. Inspired by the fact that both terms in the square brakets are of the form $$x^qB\left(\frac{y}{x};N,p+1\right)$$ I used one of the possible hypergeometric representations of the incomplete beta function, namely $$B(x;a,b)=\frac{x^a(1-x)^{b-1}}{a}{}_2F_1\left(1,1-b;a+1;\frac{x}{x-1}\right),$$ where $${}_2F_1(\alpha,\beta;\gamma;z)$$ is the hypergeometric function. Incidentally, this simplified a little bit the starting expression, which became after some simple algebra $$\begin{equation}\begin{split} S^{(p)}(N)&=\frac{2^{1-p}}{N^{N+p}}\sum_{k=1}^{\left\lfloor\frac{N-1}{2}\right\rfloor}(N-2k)^N(1+2k)^p\left[{}_2F_1\left(1,-p;N+1;-\frac{2(N-2k)}{1+2k}\right)\right.\\[6pt] &\left.\quad-{}_2F_1\left(1,-p;N+1;-\frac{N-2k}{1+2k}\right)\right]. \end{split}\end{equation}$$ I wonder whether further simplifications can be performed, especially considering that the two hypergeometric functions differ only by a factor of $$2$$ in the last argument. I looked for a possible use of this observation, e.g. here, but I did not find anything readily applicable to the problem.

(B) Setting $$M=\left\lfloor\frac{N-1}{2}\right\rfloor$$ for simplicity I approximated the sum with an integral in the large $$N$$ limit $$\begin{equation}\begin{split} S^{(p)}(N)&\sim 2N^2\int_{\frac{1}{N}}^{\frac{M}{N}}\left[\left(1-x+\frac{1}{2N}\right)^{N+p}B\left(\frac{1-2x}{1-x+\frac{1}{2N}};N,p+1\right)\right.\\[6pt] &\left.\quad-\frac{\left(1+\frac{1}{N}\right)^{N+p}}{2^p}B\left(\frac{1-2x}{1+\frac{1}{N}};N,p+1\right)\right]\text{d}x. \end{split}\end{equation}$$ At this point I discovered that Mathematica directly evaluates the integral of the second term in the square brakets, which results in (I am still trying to obtain this result analytically) $$\begin{equation}\begin{split} &\int_{\frac{1}{N}}^{\frac{M}{N}}B\left(\frac{1-2x}{1+\frac{1}{N}};N,p+1\right)\text{d}x\\[6pt] &=\frac{1}{2N}\left\{(2M-\frac{Np}{N+p+1})B\left(\frac{N-2M}{N+1};N,p+1\right)\right.\\[6pt] &\quad\left.-\left(2-\frac{Np}{N+p+1}\right)B\left(\frac{N-2}{N+1};N,p+1\right)\right.\\[6pt] &\quad\left.+\frac{1}{(N+p+1)(N+1)^{N+p}}\left[3^{p+1}(N-2)^N-(2M+1)^{p+1}(N-2M)^N\right]\right\}. \end{split}\end{equation}$$ I wonder if something similar can be obtained for the first term, which can be rewritten as $$\begin{equation}\begin{split} &\int_{\frac{1}{N}}^{\frac{M}{N}}\left(1-x+\frac{1}{2N}\right)^{N+p}B\left(\frac{1-2x}{1-x+\frac{1}{2N}};N,p+1\right)\text{d}x\\[8pt] &\quad=-\left(1+\frac{1}{N}\right)^{N+p+1}\int_{\frac{2(N-2)}{2N-1}}^{\frac{2(N-2M)}{2N-2M+1}}(2-y)^{-N-p-2}B(y;N,p+1)\text{d}y, \end{split}\end{equation}$$ or equivalently as $$\begin{equation} =\frac{1}{N}\int_{\frac{1}{N}}^{\frac{M}{N}}\left(1-2x\right)^N\left(x+\frac{1}{2N}\right)^p{}_2F_1\left(1,-p;N+1;-\frac{2x-1}{x+\frac{1}{2N}}\right)\text{d}x. \end{equation}$$