NOTE: This is all from Desmos and manually plugging in numbers and solving to find lines. There has been no proof done of what I'm talking about, and I don't really know the math necessary to do such a proof.
Here's the sum: $\lim_{p\to\infty}\sum_{n=1}^{p}\frac{\lfloor nx \rfloor}{p^{2}}=\frac{x}{2}$. I'd really like to understand why this works. For powers of $p$ greater than $2$, this goes to $0$ and powers of $p$ less than $2$ it goes to $\infty$, but it's not clear at all to me that that would be how it converges. Can someone help go through a proof of this or at least explain a bit of why it would go to $\frac{x}{2}$ in one place and collapse/diverge everywhere else?
The exponent $2$ is “special” because $\lfloor nx \rfloor \sim nx$ for $x \ne 0$ and large $n$, and $$ \sum_{n=1}^p n = \frac 12 p(p+1) $$ is a quadratic polynomial in $p$.
For positive integers $p$, real $a > 0$ and real $x \ne 0$ is $$ \sum_{n=1}^{p}\frac{ \lfloor nx \rfloor}{p^{a}} \le \sum_{n=1}^{p}\frac{ nx }{p^{a}} = \frac{p(p+1)}{2p^a} x = \frac{1}{p^{a-2}} \cdot \frac{p+1}{p}\cdot \frac x2 $$ and $$ \sum_{n=1}^{p}\frac{\lfloor nx \rfloor}{p^{a}} \ge \sum_{n=1}^{p}\frac{ nx -1}{p^{a}} = \frac{p(p+1)}{2p^a} x - \frac{1}{p^{a-1}} = \frac{1}{p^{a-2}} \cdot \frac{p+1}{p} \cdot \frac x2 \left(1 - \frac{2}{(p+1)x} \right) \, . $$ For $p \to \infty$ both the lower bound and the upper bound