Prove that there exists a constant $C \in \mathbb{R}$ so that
$$\sum_{k=1}^{N}\frac{1}{k}=\log{N}+C+O\left(\frac{1}{N}\right)$$
Prove that there exists a constant $C \in \mathbb{R}$ so that
$$\sum_{k=1}^{N}\frac{1}{k}=\log{N}+C+O\left(\frac{1}{N}\right)$$
We want to determine say something about $$\sum_{k=1}^N\frac{1}{k}-\log N=\sum_{k=1}^N\frac{1}{k}-\int_1^N\frac{1}{x}\mathrm{d}x=\sum_{k=1}^N\left(\frac{1}{k}-\int_k^{k+1}\frac{1}{x}\mathrm{d}x\right)+\int_N^{N+1}\frac{1}{x}\mathrm{d}x,$$ and prove that it goes to $C+O(1/N)$ for some constant $C\in\mathbb{R}$, as $N$ goes to $\infty$.
Note that $$\int_N^{N+1}\frac{1}{x}\mathrm{d}x<\frac{1}{N}=O(1/N),$$ so we can ignore this term.
Because $\frac{1}{k}\geq\int_k^{k+1}\frac{1}{x}\mathrm{d}x\geq\frac{1}{k+1}$, it follows that $$0\leq\frac{1}{k}-\int_k^{k+1}\frac{1}{x}\mathrm{d}x\leq\frac{1}{k}-\frac{1}{k+1}=\frac{1}{k(k+1)}\leq\frac{1}{k^2}.$$
Using the previous line, it follows that the sum $\sum_{k=1}^N\frac{1}{k}-\log N$ converges, because we first proved that the term $\int_N^{N+1}\frac{1}{x}\mathrm{d}x$ can be ignored, and the remaining sum can be absolutely bounded by $\sum_{k=1}^N\frac{1}{k^2}$, and we know that this sum converges. From now on, let $$\lim_{N\rightarrow\infty}\left(\sum_{k=1}^N\frac{1}{k}-\log N\right)=C.$$
Now we want to say something about the error term. Here we use the character $M$ instead of $N$, because we want to let $N$ go to $\infty$, and consider the error term of the $M$th partial sum. Consider $$\lim_{N\rightarrow\infty}\left(\sum_{k=1}^N\frac{1}{k}-\log N\right)-\left(\sum_{k=1}^M\frac{1}{k}-\log M\right),$$ which is equal to $$\lim_{N\rightarrow\infty}\left(\sum_{k=1}^N\left(\frac{1}{k}-\int_k^{k+1}\frac{1}{x}\mathrm{d}x\right)+\int_N^{N+1}\frac{1}{x}\mathrm{d}x\right)-\left(\sum_{k=1}^M\left(\frac{1}{k}-\int_k^{k+1}\frac{1}{x}\mathrm{d}x\right)+\int_M^{M+1}\frac{1}{x}\mathrm{d}x\right),$$ which is equal to $$\lim_{N\rightarrow\infty}\sum_{k=M+1}^N\left(\frac{1}{k}-\int_k^{k+1}\frac{1}{x}\mathrm{d}x\right)-\int_M^{M+1}\frac{1}{x}\mathrm{d}x.$$
We already know that $\int_M^{M+1}\frac{1}{x}\mathrm{d}x=O(1/M)$ and from $0\leq\frac{1}{k}-\int_k^{k+1}\frac{1}{x}\mathrm{d}x\leq\frac{1}{k^2}$ follows that $$0\leq\lim_{N\rightarrow\infty}\sum_{k=M+1}^N\left(\frac{1}{k}-\int_k^{k+1}\frac{1}{x}\mathrm{d}x\right)\leq\lim_{N\rightarrow\infty}\sum_{k=M+1}^N\frac{1}{k^2}\leq\lim_{N\rightarrow\infty}\int_M^N\frac{1}{x^2}\mathrm{d}x=\frac{1}{M},$$ which proves that $$\sum_{k=1}^N\frac{1}{k}-\log N-C=O(1/N).$$