The below texts are from the book Introduction to Analytic Number Theory by Apostol:
Note. Part (d) Thm 3.2 [green-underlined] is $$\sum_{n\le x}n^a=\dfrac{x^{a+1}}{a+1} +O(x^a) \ \ \text{if} \ a\ge0.$$
I don't understand the-red-underlined-equation. My questions are:
1- Summation in the equation of part (d)of Thm 3.2 is over all of $n\le x$ i.e. $1, 2, \dots, [x] $. But, in the red-underlined eq. summation (for fixed $d$) is not over all of the positive integers less than $\frac{x}{d}$; i.e. only over those are the lattice points. So why use of a wrong equation?
2- Even with an intuitive way of thought, the-red-underlined-equation does not make sense: If $O(1)$ means some constant for any $x$ and any $d$ so the number of lattice points is fully determined by $x$ for fixed $d$; and, if the 'constant' $O(1)$ varies with the choice of $x$ and $d$, so the equation doesn't say anything at all, said differently, the number of positive integers between $1$ and $\frac{x}{d}$ carrying some characteristic [def. of $q$] is $\frac{x}{d} - \text{some number}$, (trivial statement!).
I believe these two questions are different and I would truly appreciate simple clear explanations.
Edit. Figure 3.1 is added below.

