Evaluating the indefinite Harmonic number integral $\int \frac{1-t^n}{1-t} dt$ It is well-known that we can represent a Harmonic number as the following integral:
$$H_n = \int_0^1 \frac{1-t^n}{1-t} dt$$
The derivation of this integral doesn't need you to derive the indefinite integral  first, so now I'm wondering what the indefinite integral is and how one can derive it. According to WolframAlpha the indefinite integral is:
$$\int \frac{1-t^n}{1-t} dt = \frac{t^{n+1}{}_2F_1(1,n+1;n+2;t)}{n+1} - \ln(1-t) + C$$
where ${}_2F_1(a,b;c;z)$ is a Hypergeomtric function. I understand why $-\ln(1-t)$ is at the end, that's the result of splitting up the integrand, but I don't understand how a Hypergeometric function ends up there.
 A: Note that for $n\in\mathbb{N}$, we have
$$\frac{1-t^n}{1-t}=1+t+t^2+\cdots+t^{n-1}$$
It follows that
$$\int\:\frac{1-t^n}{1-t}\:dt=t+\frac{t^2}{2}+\frac{t^3}{3}+\cdots+\frac{t^n}{n}+C$$
A: The hypergeometric function appears as a "correction" cutting off the infinite tail of the series of $\log(1-t)$ to leave a polynomial in $t$.
Without loss of generality we can consider the definite integral
$$i(t) = \int_0^t \frac{1-x^n}{1-x}\,dx\tag{1}$$
On the one hand we have (as has been shown in other answers here)
$$i(t) = s(t) = t+\frac{t^2}{2}+\frac{t^3}{3}+\ldots+\frac{t^n}{n}\tag{2}$$
On the other hand we can write
$$i(t) = \int_0^t \frac{1}{1-x}\,dx-  \int_0^t \frac{x^n}{1-x}\,dx\\=-\log(1-t) - f(t)\tag{3}$$
where
$$f(t) = \int_0^t \frac{x^n}{1-x}\,dx\tag{4}$$
From $(2)$ and the expansion
$$\log(1-t) = -\sum_{k=1}^{\infty} \frac{t^k}{k}$$
or directly from $(4)$ by expanding the denominator we find that
$$f(t) =  - \log(1-t) -s(t)=  \sum_{k=n+1}^{\infty}\frac{t^k}{k}=t^{n+1}\sum_{k=0}^{\infty}\frac{t^k}{n+1+k}\tag{5}$$
Now consider the definiton of the hypergeometric function (https://en.wikipedia.org/wiki/Hypergeometric_function)
$$_2 F _1 (a,b;c;z) = \sum_{k=0}^{\infty} \frac{(a)_k (b)_k}{(c)_k} \frac{z^k}{k!}$$
Where the Pochhammer symbol is defined as
$$(a)_k = \frac{\Gamma(a+k)}{\Gamma(a)}$$
It can easily be shown that we can match the infnite sum $(5)$ with the hypergeometric series with the parameters $(a,b,c,z) = (1,1+n,2+n,t)$
Indeed
$$(1)_k = \frac{\Gamma(1+k)}{\Gamma(1)}=k!$$
$$\frac{(n+1)_k}{(n+2)_k} = \frac{\Gamma(n+1+k)}{\Gamma(n+1)}\frac{\Gamma(n+2)}{\Gamma(n+2+k)}\\= \frac{n+1}{n+1+k}$$
Hence we find
$$f(t) =\frac{ t^{n+1}}{n+1}  \;_2 F _1 (1,1+n;2+n;t)\tag{6}$$
as given in the OP.
Discussion
§1. $f(t)$ in the form $(4)$ can also be expressed through the incomplete Beta function defined as
$$B_t(a,b)= \int_0^t x^{a-1} (1-x)^{b-1} \, dx\tag{7a}$$
with the parameters $a=n$ and $b=0$ as
$$f(t) = B_t(n,0)\tag{7b}$$
§2. It is interesting that the formula analogous to $(1)$ with the integration path changed from $[0,t]$ to $[0,-t]$ gives the (negative) of the alternating harmonic sum
$${\overline H_n} = \sum_{k=1}^n \frac{(-1)^{k+1}}{k}= a(t=1)
\tag{8a}$$
where instead of $f(t)$ we have now
$$a(t) = -\int_0^{-t} \frac{1-x^n}{1-x} \, dx= \int_0^{t} \frac{1-(-1)^n x^n}{1+x} \, dx \\=B_{-t}(n+1,0)+\log (t+1)\\=\frac{(-1)^{n+1} t^{n+1}}{n+1} \, _2F_1(1,n+1;n+2;-t)+\log (t+1)
\tag{8b}$$
A: $$\int \frac{1-t^n}{1-t} dt=\int \frac{(1-t)(1+t+t^2
+t^3+\ldots+t^{n-1})}{1-t} dt$$
$$=\int (1+t+t^2
+t^3+\ldots+t^{n-1})dt$$
$$=t+\frac{t^2}{2}+\frac{t^3}{3}
+\ldots+\frac{t^{n}}{n}+C$$
A: The integrand is (in the complex field) a meromorphic function, with one pole coinciding with one of the zeros, and therefore removable,
leaving a polynomial defined over the whole complex field. So it is its integral.
A) polynomial form
Let's define
$$
\eqalign{
  & I_{\,n} (x,a) = \int_{t\, = \,a}^{\;x} {{{1 - t^{\,n} } \over {1 - t}}dt}  =  - \int_{t\, = \,a}^{\;x} {{{1 - \left( {1 - u} \right)^{\,n} } \over u}du}  =   \cr 
  &  = \int_{u\, = \,1 - a}^{\;1 - x} {{{\left( {1 - u} \right)^{\,n}  - 1} \over u}du}  = \int_{u\, = \,0}^{\;1 - x} {{{\left( {1 - u} \right)^{\,n}  - 1} \over u}du}  - \int_{u\, = \,0}^{\;1 - a} {{{\left( {1 - u} \right)^{\,n}  - 1} \over u}du}  =   \cr 
  &  = J_{\,n} (1 - x) - J_{\,n} (1 - a) \cr} 
$$
so that the integration constant is inglobated in $a$.
Concerning $J_{\,n} (x) =$ we have
$$
\eqalign{
  & J_{\,n} (x) = \int_{u\, = \,0}^{\;x} {{{\left( {1 - u} \right)^{\,n}  - 1} \over u}du}  =   \cr 
  &  = \int_{u\, = \,0}^{\;x} {\sum\limits_{1\, \le \,k\, \le \,n} {\left( { - 1} \right)^{\,k} \left( \matrix{
  n \cr 
  k \cr}  \right)u^{\,k - 1} } du}  = \int_{u\, = \,0}^{\;x} {\sum\limits_{0\, \le \,k\,\left( { \le \,n - 1} \right)} {\left( { - 1} \right)^{\,k + 1} \left( \matrix{
  n \cr 
  k + 1 \cr}  \right)u^{\,k} } du}  =   \cr 
  &  = \sum\limits_{0\, \le \,k\,} {{{\left( { - 1} \right)^{\,k + 1} } \over {k + 1}}\left( \matrix{
  n \cr 
  k + 1 \cr}  \right)x^{\,k + 1} }  = x\sum\limits_{0\, \le \,k\,} {{{\left( { - 1} \right)^{\,k + 1} } \over {k + 1}}\left( \matrix{
  n \cr 
  k + 1 \cr}  \right)x^{\,k} }  \cr} 
$$
Indicating by $c_k$ the coefficient of $u^k$ we have
$$
\eqalign{
  & c_{\,k}  = {{\left( { - 1} \right)^{\,k + 1} } \over {k + 1}}\left( \matrix{
  n \cr 
  k + 1 \cr}  \right)\quad c_{\,0}  =  - n\quad   \cr 
  & {{c_{\,k + 1} } \over {c_{\,k} }} =  - {{n!} \over {\left( {k + 2} \right)\left( {k + 2} \right)!\left( {n - k - 2} \right)!}}{{\left( {k + 1} \right)\left( {k + 1} \right)!\left( {n - k - 1} \right)!} \over {n!}} =   \cr 
  &  = {{\left( {k + 1} \right)\left( {k - n + 1} \right)} \over {\left( {k + 2} \right)\left( {k + 2} \right)}} \cr} 
$$
and therefore we can put $J_{\,n} (x) $  into a hypergeometric form as
$$
J_{\,n} (x) =  - nx\sum\limits_{0\, \le \,k\,} {{{1^{\,\overline {\,k\,} } \left( { - n + 1} \right)^{\,\overline {\,k\,} } 1^{\,\overline {\,k\,} } } \over {2^{\,\overline {\,k\,} } 
  2^{\,\overline {\,k\,} } }}{{x^{\,k} } \over {k!}}}  =  - nx\;{}_3F_{\,2} \left( {\left. {\matrix{ {1,\;1,\; - \left( {n - 1} \right)}  \cr 
   {2,\;2}  \cr 
 } \,} \right|\;x} \right)
$$
which, having a negative upper term, is in fact a polynomial.
B) recursion
Splitting the binomial gives
$$
\eqalign{
  & J_{\,n} (x) = \sum\limits_{0\, \le \,k\,} {{{\left( { - 1} \right)^{\,k + 1} } \over {k + 1}}\left( \matrix{
  n \cr 
  k + 1 \cr}  \right)x^{\,k + 1} }  =   \cr 
  &  = \sum\limits_{0\, \le \,k\,} {{{\left( { - 1} \right)^{\,k + 1} } \over {k + 1}}\left( \matrix{
  n + 1 \cr 
  k + 1 \cr}  \right)x^{\,k + 1} }  - \sum\limits_{0\, \le \,k\,} {{{\left( { - 1} \right)^{\,k + 1} } \over {k + 1}}\left( \matrix{
  n \cr 
  k \cr}  \right)x^{\,k + 1} }  =   \cr 
  &  = J_{\,n + 1} (x) - \sum\limits_{0\, \le \,k\,} {{{\left( { - 1} \right)^{\,k + 1} n^{\,\underline {\,k\,} } } \over {\left( {k + 1} \right)k!}}x^{\,k + 1} }  =   \cr 
  &  = J_{\,n + 1} (x) - {1 \over {n + 1}}\sum\limits_{0\, \le \,k\,} {{{\left( { - 1} \right)^{\,k + 1} \left( {n + 1} \right)^{\,\underline {\,k + 1\,} } } \over {\left( {k + 1} \right)!}}x^{\,k + 1} }  =   \cr 
  &  = J_{\,n + 1} (x) - {1 \over {n + 1}}\sum\limits_{0\, \le \,k\,} {\left( { - 1} \right)^{\,k + 1} \left( \matrix{
  n + 1 \cr 
  k + 1 \cr}  \right)x^{\,k + 1} }  =   \cr 
  &  = J_{\,n + 1} (x) - {1 \over {n + 1}}\sum\limits_{1\, \le \,k\,} {\left( { - 1} \right)^{\,k} \left( \matrix{
  n + 1 \cr 
  k \cr}  \right)x^{\,k} }  =   \cr 
  &  = J_{\,n + 1} (x) - {1 \over {n + 1}}\left( {\sum\limits_{0\, \le \,k\,} {\left( { - 1} \right)^{\,k} \left( \matrix{
  n + 1 \cr 
  k \cr}  \right)x^{\,k} }  - 1} \right) =   \cr 
  &  = J_{\,n + 1} (x) - {1 \over {n + 1}}\left( {\left( {1 - x} \right)^{\,n + 1}  - 1} \right) \cr} 
$$
i.e.
$$
\eqalign{
  & J_{\,n + 1} (x) - J_{\,n} (x) = \int_{u\, = \,0}^{\;x} {{{\left( {1 - u} \right)^{\,n + 1}  - \left( {1 - u} \right)^{\,n} } \over u}du}  =   \cr 
  &  = \int_{u\, = \,0}^{\;x} {{{ - u\left( {1 - u} \right)^{\,n} } \over u}du}  = \int_{u\, = \,0}^{\;x} {\left( {1 - u} \right)^{\,n} d\left( {1 - u} \right)}  =   \cr 
  &  = {{\left( {1 - x} \right)^{\,n + 1}  - 1} \over {n + 1}} \cr} 
$$
and thus
$$ \bbox[lightyellow] {  
J_{\,n} (x) - J_{\,0} (x) = J_{\,n} (x) = \sum\limits_{k = 0}^{n - 1} {{{\left( {1 - x} \right)^{\,k + 1}  - 1} \over {k + 1}}} 
}$$
C) truncated logarithm
If we limit the range of $x$ in $(-1,1)$ then $ I_{\,n} (x,0)$ corresponds to the truncated expansion of $\ln{ \left( \frac{1}{1-x} \right)}$ .
So we may express it as
$$
\eqalign{
  & I_{\,n} (x,0) =   \cr 
  &  = \int_{t\, = \,0}^{\;x} {{{1 - t^{\,n} } \over {1 - t}}dt}  = \int_{t\, = \,0}^{\;x} {\sum\limits_{k = 0}^{n - 1} {t^{\,k} } dt}  = \sum\limits_{k = 0}^{n - 1} {{{x^{\,k + 1} } \over {k + 1}}}  =   \cr 
  & \quad \left| \matrix{
  \,\left| x \right| < 1 \hfill \cr 
  \;0 \le n \in Z \hfill \cr}  \right.\quad  =   \cr 
  &  =  - \ln \left( {1 - x} \right) - \int_{t\, = \,0}^{\;x} {{{t^{\,n} } \over {1 - t}}dt}  =   \cr 
  &  =  - \ln \left( {1 - x} \right) - \sum\limits_{k = n}^\infty  {{{x^{\,k + 1} } \over {k + 1}}}  =   \cr 
  &  =  - \ln \left( {1 - x} \right) - x^{\,n + 1} \sum\limits_{0\, \le \,k\,} {{{x^{\,k} } \over {\,k + n + 1}}}  =   \cr 
  &  =  - \ln \left( {1 - x} \right) - {{x^{\,n + 1} } \over {n + 1}}{}_2F_{\,1} \left( {\left. {\matrix{
   {n + 1,\;1}  \cr 
   {n + 2}  \cr 
 } \;} \right|\;z} \right) =   \cr 
  &  =  - \ln \left( {1 - x} \right) - x^{\,n + 1} \hat \Phi \left( {x,1,n + 1} \right) =   \cr 
  &  =  - \ln \left( {1 - x} \right) - x^{\,n + 1} \int_{t = 0}^\infty  {{{e^{\, - \left( {n + 1} \right)t} } \over {1 - xe^{\, - t} }}dt}  = \; \cdots  \cr} 
$$
where
$\hat \Phi $ denotes the Lerch transcendent.
Of course, many other manipulations and transformations may be applied.
However it is to underline that the connection with the logarithm may be deceptive, since the combination
with the hypergeometric, Lerch t., etc. finally shall return a polynomial.
