One way to get this is to group configurations of the neighbors according to their product.
Let's call the neighbors $\sigma_1, \sigma_2, \ldots, \sigma_k$ and the messages $m_1, m_2, \ldots, m_k$.
$$\begin{aligned}
\sum_{\sigma_1, \sigma_2, \ldots, \sigma_k} e^{\beta J_a \prod_{i=1}^k\sigma_i} \prod_{i=1}^k \frac{1+\sigma_i m_i}{2} &= \sum_{\sigma=\pm1} e^{\beta J_a \sigma} \sum_{\substack{\sigma_1, \sigma_2, \ldots, \sigma_k\\\prod_{i=1}^k\sigma_i=\sigma}} \prod_{i=1}^k \frac{1+\sigma_i m_i}{2}
\end{aligned}$$
The inner sum is
$$\begin{aligned}
\sum_{\substack{\sigma_1, \sigma_2, \ldots, \sigma_k\\\prod_{i=1}^k\sigma_i=\sigma}} \prod_{i=1}^k \frac{1+\sigma_i m_i}{2}
&=\sum_{\sigma_1, \sigma_2, \ldots, \sigma_{k-1}} \prod_{i=1}^{k-1} \frac{1+\sigma_i m_i}{2} \frac{1+\sigma\left(\prod_{i=1}^{k-1}\sigma_i\right) m_k}{2}\\
&=\sum_{\sigma_1, \sigma_2, \ldots, \sigma_{k-1}} \left[\left(\prod_{i=1}^{k-1} \frac{1+\sigma_i m_i}{2}\right)+\frac{\sigma m_k}{2}\left(\prod_{i=1}^{k-1}\frac{1+\sigma_i m_i}{2}\sigma_i \right)\right]\\
&=\frac12 \prod_{i=1}^{k-1}\underbrace{\sum_{\sigma_i}\frac{1+\sigma_i m_i}{2}}_{1} + \frac12\sigma m_k \prod_{i=1}^{k-1} \underbrace{\sum_{\sigma_i}\frac{\sigma_i + m_i}{2}}_{m_i}\\
&= \frac{1 + \sigma\prod_{i=1}^k m_i}{2}
\end{aligned}$$
Bringing everything together
$$\begin{aligned}
\sum_{\sigma = \pm 1} e^{\beta J_a \sigma}\frac{1 +\sigma \prod_{i=1}^k m_i} {2} = \cosh(\beta J_a) + \sinh\left(\beta J_a\right)\prod_{i=1}^k m_i = \cosh(\beta J_a) \left[1 + \tanh\left(\beta J_a\right)\prod_{i=1}^k m_i\right]
\end{aligned}$$
EDIT: there is a simpler way. Using the identity
$$e^x = \cosh(x)+\sinh(x)$$
on the term with $J_a$, one gets
$$\begin{aligned}
\sum_{\sigma_1, \sigma_2, \ldots, \sigma_k} e^{\beta J_a \prod_{i=1}^k\sigma_i} \prod_{i=1}^k \frac{1+\sigma_i m_i}{2} &=
\sum_{\sigma_1, \sigma_2, \ldots, \sigma_k} \left[\cosh(\beta J_a)+\sinh(\beta J_a)\prod_{i=1}^k\sigma_i\right] \prod_{i=1}^k \frac{1+\sigma_i m_i}{2}\\
%&=\cosh(\beta J_a)\sum_{\sigma_1, \sigma_2, \ldots, \sigma_k}\prod_{i=1}^k \frac{1+\sigma_i m_i}{2} + \sinh(\beta J_a)\sum_{\sigma_1, \sigma_2, \ldots, \sigma_k}\prod_{i=1}^k\frac{\sigma_i+ m_i}{2}\\
&=\prod_{i=1}^k \sum_{\sigma_i} \left[\cosh(\beta J_a)+\sinh(\beta J_a)\sigma_i\right]\frac{1+\sigma_i m_i}{2}\\
&= \prod_{i=1}^k\sum_{\sigma_i}\frac{\cosh(\beta J_a)+m_i\sinh(\beta J_a)}{2}\\
&=\cosh(\beta J_a) \left[1 + \tanh\left(\beta J_a\right)\prod_{i=1}^k m_i\right]
\end{aligned}$$