Conditional probability and Bayes Rule. 
There are k+1 coins in a box. When flipped, the $i$th coin will turn up heads with probability $\frac{i}{k} , i=0,1,...,k$.
   A coin is randomly selected and is then repeatedly flipped. If the first $n$ flips all result in heads, what is the conditional probability that the $(n+1)$ flip will do likewise?

My attempt:
Let $A_i$ is the $i$th coin is tossed and $H_n$is the $n$th coin is head 
So our given condition show that $\Bbb P(H_1|A_i)=\frac{i}{k}$.
We want to compute
$\Bbb P(H_{n+1}|\bigcap_{i=1}^{n}H_i)$.
At this moment, I cannot proceed next stage.
How to calculate above conditional probability? 
 A: In addition, let $Z_n$ be the even that the first $n$ flips are all heads, then we are interested in $P(H_{n+1} \vert Z_n)$, which is given as follows
\begin{equation}
 P(H_{n+1} \vert Z_n)
 =
 \sum_{i=0}^n
 P(H_{n+1} \vert Z_n A_i)P(A_i \vert Z_n) \tag{1}
\end{equation}
Assuming that the flipping trials are independent conditioning on the $i^{th}$ coin being the chosen one, then
\begin{equation}
 P(H_{n+1} \vert Z_n A_i)
 =
 \frac{i}{k}
\end{equation}
Using Bayes theorem, we can say
\begin{equation}
 P(A_i \vert Z_n) = \frac{P(Z_n \vert A_i)P(A_i)}{P(Z_n)}
 =
 \frac{\frac{1}{k+1}(\frac{i}{k})^n}{\frac{1}{k+1}\sum_{j=0}^k (\frac{j}{k})^n}
=
\frac{(\frac{i}{k})^n}{\sum_{j=0}^k (\frac{j}{k})^n}
\end{equation}
Replacing in $(1)$, we get
\begin{equation}
 P(H_{n+1} \vert Z_n)
 =
\sum_{i=0}^n
 P(H_{n+1} \vert Z_n A_i)P(A_i \vert Z_n)
=
\sum_{i=0}^n
 \frac{i}{k}\frac{(\frac{i}{k})^n}{\sum_{j=0}^k (\frac{j}{k})^n}
=
 \frac{\sum_{i=0}^k (\frac{i}{k})^{n+1}}{\sum_{i=0}^k (\frac{i}{k})^n} \tag{2}
\end{equation}
and we're done.

For large $k$
As $k \rightarrow \infty$, the sum becomes an integral, therefore
\begin{equation}
 \lim_{k \rightarrow \infty}
 =
 \frac{1}{k}
 \sum_{i=0}^k
 (\frac{i}{k})^{\beta}
 =
 \int_0^1
 x^\beta \ dx
 =
 \frac{1}{1+\beta}
\end{equation}
For $\beta = n+1$ in the numerator of $(2)$ and $\beta=n$ for the denominator in $(2)$, we get
\begin{equation}
 P(H_{n+1} \vert Z_n)
 =
 \frac{n+1}{n+2}
\end{equation}
As $n \rightarrow \infty$, we can see that the probability becomes $1$, which is intuitive.
A: A=coin is i 
B = there were n heads
$$P(A|B) = \frac{\frac{1}{k + 1} (\frac{i}{k})^n}{\frac{1}{k+1}(\frac{0}{k})^n + \frac{1}{k+1}(\frac{1}{k})^n + ... + \frac{1}{k+1}(\frac{k}{k})^n}  $$
$$ = \frac{(\frac{i}{k})^n}{(\frac{0}{k})^n + (\frac{1}{k})^n + ... + (\frac{k}{k})^n}  $$
$$ = \frac{i^n}{0^n + 1^n + ... + k^n}  $$
note that if you summed that for each i, you'd get 1, because the coin has to be one of them
P(head on next toss)
$$ = (\frac{0}{k} P(coin = 0) + \frac{1}{k} P(coin = 1) + ... + \frac{k}{k} P(coin = k) $$
$$ = \frac{(\frac{0}{k} 0^n + \frac{1}{k} 1^n  + ... + \frac{k}{k} k^n)}{0^n + 1^n + ... + k^n}$$
$$ = \frac{1}{k}\frac{(0^n + 1.1^n  + 2.2^n + .... + k k^n}{0^n + 1^n + ... + k^n}$$
$$ = \frac{1}{k}\frac{(0^{n + 1} + 1^{n + 1}  + 2^{n+1} + .... + k^{n+1}}{0^n + 1^n + ... + k^n}$$
