Consider a discrete positive random variable, say X. This link nicely shows that
\begin{equation} E[X] = \sum_{k=0}^{\infty} (1-F(k)) \end{equation}
Moreover,
\begin{equation} E[X^2] = \sum_{k=0}^{\infty} (2k+1)(1-F(k)) \end{equation}
I am puzzled on how to obtain the factor "(2k+1)" in above expression. It would be nice, when there were a relation between F(X) and X for higher order moments.
The answer in your link gives you the explanation already...
If $G$ is the CDF of $X^2$ then the first formula yields $$E[X^2] = \sum_{k = 0}^\infty (1 - G(k)) = (1-G(0)) + (1-G(1)) + (1-G(2)) + \cdots.$$ Since $X$ takes integer values, we have $X^2 \in \{0^2, 1^2, 2^2, 3^3, \ldots\}$, so $G(1)=G(2)=G(3)=F(1)$ and $G(4) = G(5) = G(6) = G(7) = G(8) = F(2)$ and so on. Writing all the $G$ terms (in the above sum) in terms of $F$ and collecting like terms yields the $(2k+1)(1-F(k))$ expression.