Given that the density of the primes in $$[1,N]$$ is on the order of $$\frac{1}{\ln N}$$ we’ll note that:

$$\text{Li}(N) = \int_{2}^N \frac{1}{\ln x}dx = \text{li}(N)-\text{li}(2)$$

where

$$\text{li}(N) \sim \frac{N}{\ln N} \sum_{k=0}^\infty \frac{k!}{(\ln N)^k} \sim \frac{N}{\ln N} + \frac{2N}{(\ln N)^2} + …$$

and therefore we obtain the asymptotic relation:

$$\text{li}(N) \sim \frac{N}{\ln N} + \mathcal{O}\big(\frac{N}{(\ln N)^2}\big)$$

which yields the error term:

$$\lvert \pi(N) - \frac{N}{\ln N} \rvert = \mathcal{O}\big(\frac{N}{(\ln N)^2}\big)$$

where $$\pi(N)$$ is the prime counting function.

Note: The reflections considered here are those which have probably occurred to Gauss, before the Prime Number Theorem was proven.