Since l=0 for a valence electron in 5s state of silver, L=0 and therefore magnetic dipole moment is also 0 which means that the beam should not have deflected at all. So, we introduced the property of an electron called spin which explains the deflection. However, my problem is How the introduction of spin explains the splitting of beam into two parts ?
1 Answer
As you stated in your question, the effect of an external magnetic field on an atom depends on the magnetic dipole moment of this atom. Before the introduction of spin, the only contributor to the magnetic dipole moment was the orbital dipole magnetic moment: $$ \vec{M}=\vec{M_L}=-\frac{e}{2m_e}\cdot\vec{L}$$
which does not explain the S-G experiment since its eigenvalue can only be zero when L=0.
However, with the introduction of spin we now have another contributor: the spin magnetic moment: $$ \vec{M}=\vec{M_L}+\vec{M_S}=-\mu_B\hbar^{-1}(\vec{L}+g_e\vec{S}) $$
Even if L=0, the eigenvalue(s) of $\vec{M}$ will still depend on the value of S and there can thus be several of them, which means your observation (effect of external field B) will also have several possible results which eventually means several deflection angles and splitting of your beam