Consider the binomial sampling model with a Beta prior on $\theta$ and the prior predictive
distribution. Let $n$ be the binomial sample size.
\begin{align}
p(y^{new}) &= \int_{\theta}f(y^{new}|\theta)\pi(\theta)d\theta \\
&= \binom{n}{y^{new}} \frac{\Gamma(\alpha+y^{new}) \Gamma(n - y^{new} + \beta)}{\Gamma(n + \alpha + \beta)} \cdot \frac{\Gamma(\alpha + \beta)}{\Gamma(\alpha) \Gamma(\beta)}
\end{align}
This is a Beta-Binomial distribution, which we denote Beta-Binomial(n, α, β).
For the posterior predictive distribution, given that the posterior distribution for θ is still Beta, one can substitute $α^{post}= α + y^{old}$ and $β^{post}= β + n − y^{old}$ in the above results. Letting $n^{new}$ be the new sample size, the posterior predictive distribution is then: \begin{align}p(y^{new}|y^{old}) = \binom{n^{new}}{y^{new}} \frac{\Gamma(\alpha^{post}+y^{new}) \Gamma(n^{new} - y^{new} + \beta^{post})}{\Gamma(n^{new} + \alpha^{post} + \beta^{post})} \cdot \frac{\Gamma(\alpha^{post} + \beta^{post})}{\Gamma(\alpha^{post}) \Gamma(\beta^{post})}\end{align} And I am wondering how is the formula $p(y^{new}|y^{old})$ being derived?