The spoke length formula computes the length of the space diagonal of an imaginary rectangular box. Imagine holding a wheel in front of you such that a nipple is at the top. Look at the wheel from along the axis. The spoke through the top hole is now a diagonal of the imaginary box. The box has a depth of d, a height of r2-r1cos(α) and a width of r1sin(a).
Equivalently, the law of cosines may be used to first compute the length of the spoke as projected on the wheel's plane (as illustrated in the diagram), followed by an application of the Pythagorean theorem.