Given an (infinitely long) line described by two distinct points it contains in $\mathbb{R}^n$
$$\alpha^{(1)} = (\alpha_1^{(1)}, \alpha_2^{(1)},\dots,\alpha_n^{(1)})$$ $$\alpha^{(2)} = (\alpha_1^{(2)}, \alpha_2^{(2)},\dots,\alpha_n^{(2)})$$
And a hypersphere (surface) described by a point and a radius:
$$\beta = (\beta_1, \beta_2,\dots,\beta_n)$$ $$r \in \mathbb{R} $$
Let $\gamma$ denote the (possibly empty) set of points that the line intersects the spheres surface.
Let $m = |\gamma|$
Clearly $m \in \{0,1,2\}$
By what formulae can we calculate $m$ and the locations of $\gamma$:
$$\gamma^{(1)} = (\gamma_1^{(1)}, \gamma_2^{(1)},\dots,\gamma_n^{(1)})$$ $$.$$ $$.$$ $$\gamma^{(m)} = (\gamma_1^{(m)}, \gamma_2^{(m)},\dots,\gamma_n^{(m)})$$
partial solution maybe:
$$|x-\beta| = r $$
And parameterize the line:
$$x = \alpha^{(1)} + t(\alpha^{(2)} - \alpha^{(1)})$$
So:
$$|\alpha^{(1)} + t(\alpha^{(2)} - \alpha^{(1)}) -\beta| = r $$
and then?