You ask
how can you formally go from the summation over $s$ to the double sum over $s_1$ and $s_2$?
As we'll see in a moment, passing to the double sum relies on the mathematical fact (about tensor products of Hilbert spaces) that if $s_1$ labels a basis of states for system $1$, and if $s_2$ labels a basis of states for system $2$, then the set of all pairs $(s_1, s_2)$ labels a basis of states for the composite system.
Let's assume that the system at hand is a quantum system described by a state space (Hilbert space) $\mathcal H$. Let the (state) labels $s$ index an orthonormal basis of $\mathcal H$ consisting of eigenvectors $|s\rangle$ of the total system's Hamiltonian $H$;
\begin{align}
H|s\rangle = E(s)|s\rangle,
\end{align}
then the partition function is obtained by summing over these states;
\begin{align}
Z = \sum_s e^{-\beta E(s)}.
\end{align}
Notice that the state labels $s$ don't have to be numbers. They could, for example, be pairs of numbers or triples of numbers, whatever is most convenient to label the possible states for the system at hand.
Now, suppose that the system consists of a pair of subsystems $1$ and $2$, then the Hilbert space of the combined system can be written as a tensor product of the Hilbert spaces for the individual subsystems;
\begin{align}
\mathcal H = \mathcal H_1\otimes \mathcal H_2.
\end{align}
Let $H_1$ denote the hamiltonian for subsystem $1$, and let $H_2$ denote the hamiltonian for subsystem $2$. Let $\{|1, s_1\rangle\}$ be an orthonormal basis for $\mathcal H_1$ consisting of eigenvectors of $H_1$, and let $\{|2, s_2\rangle\}$ be an orthonormal basis for $\mathcal H_2$ consisting of eigenvectors of $H_2$, then we have the following basic fact;
The tensor product states
\begin{align}
|s_1, s_2\rangle := |1,s_1\rangle\otimes|2,s_2\rangle
\end{align}
yield an orthonormal basis for the full state space $\mathcal H = \mathcal H_1\otimes \mathcal H_2$.
In particular, the set of states one needs to sum over in the partition function can be enumerated by pairs $s=(s_1, s_2)$. Moreover, if the systems are non-interacting, then the Hamiltonian of the full system is essentially the sum of the Hamiltonians of the individual subsystems (with appropriate identity operator factors);
\begin{align}
H = H_1\otimes I_2 + I_1\otimes H_2,
\end{align}
so that if $E_1(s_1)$ and $E_2(s_2)$ denote the energy eigenvalues of $H_1$ and $H_2$ corresponding to the states $|1,s_1\rangle$ and $|2, s_2\rangle$, then the energy $E(s_1, s_2)$ of a tensor product basis state is their sum;
\begin{align}
H|s_1,s_2\rangle = E(s_1, s_2)|s_1, s_2\rangle = \big(E_1(s_1) + E_2(s_2)\big)|s_1,s_2\rangle,
\end{align}
and the partition function can be written as a sum over the tensor product basis states;
\begin{align}
Z = \sum_{(s_1,s_2)} e^{-\beta E(s_1, s_2)} = \sum_{s_1}\sum_{s_2} e^{-\beta\big(E_1(s_2) + E_2(s_2)\big)} = \sum_{s_1} e^{-\beta E_1(s_1)} \sum_{s_2} e^{-\beta E(s_2)} = Z_1Z_2
\end{align}
where in the second equality we have used the fact that a single sum over all possible pairs $(s_1, s_2)$ is equivalent to iterated sums over the possible values of $s_1$ and $s_2$.