An easy (but fun) derivation

Let us consider the arbitrary direction $$ \hat{n} = \sin\theta\cos\phi \,\hat{x} + \sin\theta\sin\phi \,\hat{y} + \cos\theta \,\hat{z}. $$ Its operator matrix $S_n$ is $$ S_n = \frac{\hbar}{2} \begin{pmatrix} \cos\theta & \sin\theta\,\mathrm{e}^{-i\phi} \\ \sin\theta\,\mathrm{e}^{i\phi} & -\cos\theta \end{pmatrix}. $$

The characteristic equation of this matrix is \begin{equation*} \begin{vmatrix} \frac{\hbar}{2}\cos\theta-\lambda & \frac{\hbar}{2}\sin\theta\,\mathrm{e}^{-i\phi} \\ \frac{\hbar}{2}\sin\theta\,\mathrm{e}^{i\phi} & -\frac{\hbar}{2}\cos\theta-\lambda \end{vmatrix} = 0. \end{equation*}

The eigenvalues of this equation are $$ \lambda = \pm \frac{\hbar}{2}, $$

and the eigenspinors are obtained in the usual way: \begin{equation*} \frac{\hbar}{2} \begin{pmatrix} \cos\theta & \sin\theta\,\mathrm{e}^{-i\phi} \\ \sin\theta\,\mathrm{e}^{i\phi} & -\cos\theta \end{pmatrix} \begin{pmatrix} \alpha \\ \beta \end{pmatrix} = \pm \frac{\hbar}{2} \begin{pmatrix} \alpha \\ \beta \end{pmatrix}. \end{equation*}

Therefore, we have the relation $$ \frac{\hbar}{2} \left(\alpha \cos\theta + \beta \sin\theta\,\mathrm{e}^{-i\phi}\right) = \pm \frac{\hbar}{2} \alpha. $$

Taking the positive and negative signs yields respectively \begin{eqnarray*} \beta = \alpha \frac{1 - \cos\theta}{\sin\theta} \mathrm{e}^{i\phi} = \alpha \tan\left(\frac{\theta}{2}\right)\mathrm{e}^{i\phi} & \quad\text{and}\quad\, & \beta = -\alpha \frac{1 + \cos\theta}{\sin\theta} \mathrm{e}^{i\phi} = -\alpha \cot\left(\frac{\theta}{2}\right)\mathrm{e}^{i\phi}. \end{eqnarray*}

The, the normalized eigenspinors are respectively \begin{eqnarray*} \chi_+^{(n)} = \begin{pmatrix} \cos(\theta/2) \\ \mathrm{e}^{i\phi} \sin(\theta/2) \end{pmatrix} & \quad\text{and}\quad\, & \chi_-^{(n)} = \begin{pmatrix} \sin(\theta/2) \\ -\mathrm{e}^{i\phi} \cos(\theta/2) \end{pmatrix}. \end{eqnarray*}

These eigenspinors span the space. In other words, they form a complete base and any spinor $$ |\chi\rangle = \begin{pmatrix} a \\ b \end{pmatrix} $$ can be expressed as a linear combination of them. It is straightforward to show that the probabilities of obtaining $+\hbar/2$ and $-\hbar/2$ when measuring $S_n$ are respectively \begin{eqnarray*} P_+ = |a\cos(\theta/2) + b\sin(\theta/2)\,\mathrm{e}^{-i\phi}|^2 & \quad\text{and}\quad\, & P_- = |a\sin(\theta/2) - b\cos(\theta/2)\,\mathrm{e}^{-i\phi}|^2 \end{eqnarray*}

The maths have been derived, and we are now ready to tackle the Stern-Gerlach system. Let's say we have an input state $|\chi\rangle$. If the electron goes through an analyzer $\hat{n}$-oriented, the probability of obtaining $+\hbar/2$ is $P_+$ and the probability of obtaining $-\hbar/2$ is $P_-$. In the first case, the spinor collapses to $\chi_+^{(n)}$; and in the second case, the spinor collapses to $\chi_-^{(n)}$ after the measurement. Knowing the new state, we send the electron in another analyzer, and so on. We keep track of the probabilities in each path. This experience clearly shows the statistical interpretation of quantum mechanics. After all, the Stern-Gerlach system can be seen as a probability tree.