[proofplan]
We let the $\mathfrak{sl}_2$-subalgebra generated by $\alpha$ act on the direct sum of the root spaces lying in the $\alpha$-string through $\beta$. The assumptions $\beta \ne \pm \alpha$ ensure that this string contains no zero weight space, so the direct sum is stable under $e_\alpha$, $f_\alpha$, and $h_\alpha$. The trace of $h_\alpha=[e_\alpha,f_\alpha]$ on this finite-dimensional stable subspace is zero, while the same trace is the sum of the eigenvalues $\beta(h_\alpha)+2n$ over the string. Equating these two computations gives $\beta(h_\alpha)=r-q$.
[/proofplan]
[step:Build the finite-dimensional module carried by the root string]
For each integer $n$ with $-r \le n \le q$, define the root
\begin{align*}
\gamma_n := \beta+n\alpha \in \Phi.
\end{align*}
Define the finite-dimensional complex [vector space](/page/Vector%20Space)
\begin{align*}
M := \bigoplus_{n=-r}^{q} \mathfrak{g}_{\gamma_n} \subset \mathfrak{g}.
\end{align*}
Because $\gamma_n \in \Phi$, each $\mathfrak{g}_{\gamma_n}$ is a one-dimensional root space. Since $\beta \ne \alpha$ and $\beta \ne -\alpha$, no root in the displayed string is $0$: if $\beta+n\alpha=0$, then $\beta=-n\alpha$, and the root system property that the only scalar multiples of $\alpha$ in $\Phi$ are $\alpha$ and $-\alpha$ would force $\beta=\alpha$ or $\beta=-\alpha$.
We show that $M$ is stable under the subalgebra
\begin{align*}
\mathfrak{s}_\alpha := \operatorname{span}_{\mathbb{C}}\{e_\alpha,h_\alpha,f_\alpha\}.
\end{align*}
Let $x \in \mathfrak{g}_{\gamma_n}$. Since $[h,y]=\gamma_n(h)y$ for every $h \in \mathfrak{h}$ and $y \in \mathfrak{g}_{\gamma_n}$, we have
\begin{align*}
[h_\alpha,x]=\gamma_n(h_\alpha)x \in \mathfrak{g}_{\gamma_n}.
\end{align*}
Also,
\begin{align*}
[e_\alpha,x]\in \mathfrak{g}_{\alpha+\gamma_n}=\mathfrak{g}_{\beta+(n+1)\alpha}
\end{align*}
if $\beta+(n+1)\alpha \in \Phi$, and $[e_\alpha,x]=0$ otherwise. By maximality of $q$, the latter case occurs at the upper end $n=q$. Thus $e_\alpha M \subset M$. Similarly,
\begin{align*}
[f_\alpha,x]\in \mathfrak{g}_{-\alpha+\gamma_n}=\mathfrak{g}_{\beta+(n-1)\alpha}
\end{align*}
if $\beta+(n-1)\alpha \in \Phi$, and $[f_\alpha,x]=0$ otherwise. By maximality of $r$, this gives $f_\alpha M \subset M$. Hence $M$ is stable under $\mathfrak{s}_\alpha$.
[/step]
[step:Compute the trace of $h_\alpha$ on the string module from root-space eigenvalues]
For each integer $n$ with $-r \le n \le q$, the element $h_\alpha$ acts on $\mathfrak{g}_{\gamma_n}$ by the scalar $\gamma_n(h_\alpha)$. Since
\begin{align*}
\gamma_n(h_\alpha)=(\beta+n\alpha)(h_\alpha)=\beta(h_\alpha)+n\alpha(h_\alpha),
\end{align*}
and $\alpha(h_\alpha)=2$ by the normalization of the coroot element in the $\mathfrak{sl}_2$-triple, the eigenvalue on $\mathfrak{g}_{\gamma_n}$ is
\begin{align*}
\beta(h_\alpha)+2n.
\end{align*}
Each root space $\mathfrak{g}_{\gamma_n}$ is one-dimensional, so the trace of the [linear map](/page/Linear%20Map) $\operatorname{ad}(h_\alpha)|_M:M\to M$ is
\begin{align*}
\operatorname{tr}(\operatorname{ad}(h_\alpha)|_M)
&=\sum_{n=-r}^{q}\bigl(\beta(h_\alpha)+2n\bigr) \\
&=(r+q+1)\beta(h_\alpha)+2\sum_{n=-r}^{q}n.
\end{align*}
The finite arithmetic sum is
\begin{align*}
\sum_{n=-r}^{q}n
=\sum_{n=1}^{q}n-\sum_{n=1}^{r}n
=\frac{q(q+1)}{2}-\frac{r(r+1)}{2}.
\end{align*}
Therefore
\begin{align*}
\operatorname{tr}(\operatorname{ad}(h_\alpha)|_M)
=(r+q+1)\beta(h_\alpha)+q(q+1)-r(r+1).
\end{align*}
[/step]
[step:Compute the same trace as the trace of a commutator]
On $M$, the operators induced by $e_\alpha$, $f_\alpha$, and $h_\alpha$ satisfy the same bracket relation as in $\mathfrak{g}$:
\begin{align*}
[\operatorname{ad}(e_\alpha)|_M,\operatorname{ad}(f_\alpha)|_M]
=\operatorname{ad}([e_\alpha,f_\alpha])|_M
=\operatorname{ad}(h_\alpha)|_M.
\end{align*}
Since $M$ is finite-dimensional, the trace of a commutator of endomorphisms of $M$ is zero. Hence
\begin{align*}
\operatorname{tr}(\operatorname{ad}(h_\alpha)|_M)=0.
\end{align*}
Combining this with the trace formula from the previous step gives
\begin{align*}
0=(r+q+1)\beta(h_\alpha)+q(q+1)-r(r+1).
\end{align*}
Factor the last two terms:
\begin{align*}
q(q+1)-r(r+1)
&=(q-r)(q+r+1).
\end{align*}
Thus
\begin{align*}
0=(r+q+1)\beta(h_\alpha)+(q-r)(r+q+1).
\end{align*}
Since $r+q+1>0$, division by $r+q+1$ gives
\begin{align*}
\beta(h_\alpha)=r-q.
\end{align*}
[/step]
[step:Conclude integrality]
The integers $r$ and $q$ are nonnegative by construction, so $r-q \in \mathbb{Z}$. Since $\beta(h_\alpha)=r-q$, it follows that
\begin{align*}
\beta(h_\alpha)\in\mathbb{Z}.
\end{align*}
This proves both the root string formula and the asserted integrality.
[/step]