The canonical partition function is given by:
\[
Z_c = \sum_i e^{-\frac{E_i}{k_B T}}
\]
where the sum runs over all possible microstates and $E_i$ is the energy of microstate $i$. For one molecule adsorbed on one site on the surface we thus have:
\[
Z_c^{(1)} = e^{0} + e^{-\frac{U}{k_B T}} = 1 + e^{-\frac{U}{k_B T}}
\]
As it's energy can be either equal to 0 or $U$. For $N$ particles we thus have:
\[
\begin{aligned}
Z_c^{(N)} & = \frac{M!}{M!(M-N)!} \sum_{i_1} \sum_{i_2} \sum_{i_1} \dots
\sum_{i_N} e^{-\frac{E_{i_1} + E_{i_2} + E_{i_3} + \dots + E_{i_N}}{k_B T}} \\
& = \frac{M!}{M!(M-N)!} \sum_{i_1} \sum_{i_2} \sum_{i_1} \dots \sum_{i_N}
\prod_{j=1}^N e^{-\frac{E_{i_j}}{k_B T}} \\
& = \frac{M!}{M!(M-N)!} \sum_{i_1} e^{-\frac{E_{i_1}}{k_B T}} \sum_{i_2}
e^{-\frac{E_{i_2}}{k_B T}}
\sum_{i_3} e^{-\frac{E_{i_3}}{k_B T}} \dots \sum_{i_N} e^{-\frac{E_{i_N}}{k_B
T}} \\
& = \frac{M!}{M!(M-N)!} \left(Z_c^{(1)}\right)^N = \frac{M!}{M!(M-N)!} \left(1
+ e^{-\frac{U}{k_B T}}\right)^N
\end{aligned}
\]
The factor of $\frac{M!}{M!(M-N)!}$ comes about because when $N$ particles adsorb there will be $N$ filled sites and $M$ empty sites. Hence, because
we have to sum over all possible microstates when calculating the partition function, we have to consider all possible arrangements of the $N$ atoms
on the $M$ absorbption sites. As discussed in the answer to the first part of this question we can calculate the number of orderings of $N$ filled sites
and $M-N$ empty sites using the binomial coefficients.