I am given $X_1,…, X_n$ as a sample of $iid$ $Bin(1, )$ random variables where $Θ = [0, 1]$, and we are assuming that the prior distribution of is $U[0, 1]$
Therefore, the likelihood function for the observed sample is
$L(\theta) = \prod_{i=1}^n \theta^{x_i}(1-\theta)^{1-x_i} = \theta^{\sum_{i=1}^nx_i}(1-\theta)^{n-\sum_{i=1}^nx_i}$
Therefore, the posterior is written as follows:
$f(\theta|\textbf{x}) = \frac{\theta^{\sum_{i=1}^nx_i}(1-\theta)^{n-\sum_{i=1}^nx_i}}{\int_0^1 \theta^{\sum_{i=1}^nx_i}(1-\theta)^{n-\sum_{i=1}^nx_i}d\theta} = \frac{\theta^{\sum_{i=1}^nx_i}(1-\theta)^{n-\sum_{i=1}^nx_i}}{\frac{\Gamma(1 + \sum_{i=1}^nx_i)\Gamma(n-1 + \sum_{i=1}^nx_i)}{\Gamma(n+2)}}$
My question is how did we know that the $ \int_0^1 \theta^{\sum_{i=1}^nx_i}(1-\theta)^{n-\sum_{i=1}^nx_i}d\theta = \frac{\Gamma(1 + \sum_{i=1}^nx_i)\Gamma(n-1 + \sum_{i=1}^nx_i)}{\Gamma(n+2)}$?
Is there a formula or a general pattern for this?
The posterior can be easily found remembering, as usual, that
$$ \bbox[5px,border:2px solid red] { \pi(\theta|\mathbf{x})\propto \pi(\theta)\times p(\mathbf{x}|\theta) \ } $$
Thus, being $\pi(\theta)=1$, you have
$$\pi(\theta|\mathbf{x})\propto \theta^{\Sigma x}(1-\theta)^{n-\Sigma x}\sim Beta(\Sigma x+1;n-\Sigma x+1)$$
Now, remembering how the analytical expression of a Beta density is, the complete analytical expression of your posterior is
$$ \bbox[5px,border:2px solid red] { Beta(a,b)=\frac{\Gamma(a+b)}{\Gamma(a)\Gamma(b)}\theta^{a-1}(1-\theta)^{b-1} \qquad (1) } $$
Substituting (1) in your exercise you get immediately
$$\pi(\theta|\mathbf{x})=\frac{\Gamma(n+2)}{\Gamma(\Sigma x+1)\Gamma(n-\Sigma x+1)}\theta^{\Sigma x}(1-\theta)^{n-\Sigma x}$$
The result of your integral is wrong. At a certain point you wrote $\Gamma(n-1+\Sigma x)$ while the correct expression is $\Gamma(n-\Sigma x+1)$