I was searching for the reason why Stirling's Approximation holds true. I found the website Stirling's Approximation which apparently shows why this is the case. Does this part of the equation make sense in the proof? If so why?
$$\int_{1}^{n}\ln(x)dx\approx\sum_{k=1}^{n}\ln(k)$$
For large $n$, the approximation holds, because $$\sum_{k=1}^{n-1} \log k = \int_{x=1}^n \log \lfloor x \rfloor \, dx < \int_{x=1}^n \log x \, dx < \int_{x=1}^n \log \lceil x \rceil \, dx = \sum_{k=2}^n \log k.$$ Therefore, the error between the integral and sum is at most $O(\log n)$, which is what the asymptotic statement of Stirling's approximation provides: $$\log n! \sim n \log n - n + O(\log n).$$