The Hamiltonian for one-dimensional Ising model is given by, \begin{equation} \mathcal{H} = -J\sum_{<ij>} S_iS_j; \quad i,j=1,2,...,N+1 \end{equation} where $<ij>$ denotes that there is nearest neighbor approximation. The partition function is given by, \begin{equation} \mathcal{Z}=\sum_{\{S_i\}} e^{-\beta \mathcal{H}(S_i)} \end{equation} with $\beta = \frac{1}{k_BT}$, where $k_B$ is the Boltzmann constant and $T$ is the temperature. Now my questions are:
1. How to compute the partition function when $S_{N+1}=+1$ while other spins ($S_i$ for $i=1,2,...,N$) may take value $+1$ or $-1$?
2. How to compute the partition function when $S_{N+1}=-1$ while other spins ($S_i$ for $i=1,2,...,N$) may take value $+1$ or $-1$?