How do I show that as $z \to \infty$ we have
$$ \int_0^\infty \frac{t - \lfloor t \rfloor - 1/2}{z + t} \,dt = O(z^{-1} )? $$
According to Serge Lang, the integral on the left is the error term for Stirling's asymptotic bound for $\log(\Gamma(z))$, but I read elsewhere that the integral is equivalent to the right hand side. I am trying to find a rigorous way to show that the statement above is true, that is, without resorting to looking at a graph on WolframAlpha.
There is a closed form of your integral.
Proposition. Let $z$ be a complex number such that $\Re z>0$. We have
Proof. Let $\Re z>0$. We may write $$ \begin{align} &\int_0^\infty \frac{t - \lfloor t \rfloor - 1/2}{z + t} dt \\\\&= \int_0^1 \frac{t - \lfloor t \rfloor - 1/2}{z + t} dt+\int_1^\infty \frac{\left\{t\right\} - 1/2}{z + t} dt\\\\ &= \int_0^1 \frac{t- 1/2}{z + t} dt+\int_0^1 \frac{\left\{1/u\right\} - 1/2}{u(zu+1)} du\\\\ &= \int_0^1 \frac{t- 1/2}{z + t} dt+\int_0^1 \frac{\left\{1/u\right\} - 1/2}{u} du-z\int_0^1 \frac{\left\{1/u\right\} - 1/2}{zu+1} du\\\\ &= \underbrace{\int_0^1 \frac{t- 1/2}{z + t} dt+\frac{z}{2}\int_0^1 \frac{1}{zu+1} du}+\underbrace{\int_0^1 \frac{\left\{1/u\right\} - 1/2}{u} du}-\underbrace{\int_0^1 \frac{\left\{1/u\right\}}{u+1/z} du} \\\\ &= \qquad \qquad \qquad \quad I_1\qquad \qquad +\qquad \qquad \quad I_2\qquad-\qquad \qquad I_3 \end{align} $$ $I_1$ is elementary: $$ I_1=1+\left(z+1/2\right) \log z -z \log (1+z) $$
The integral $I_2$ has already been evaluated (see for example here): $$ I_2=-1+\frac12 \log (2\pi) $$ To evaluate $I_3$, we have $$ \begin{align} I_3=\int_0^1 \frac{\left\{1/u\right\}}{u+1/z} du &= \sum_{k=1}^{\infty} \displaystyle \int_{1/(k+1)}^{1/k} \frac{\left\{1/u\right\}}{u+1/z} du \\\\ & = z\sum_{k=1}^{\infty} \int_{k}^{k+1} \frac{\left\{v\right\}}{v(v+z)}dv \\\\ & = z\int_{0}^{1}\sum_{k=1}^{\infty} \frac{x}{(x+k)(x+k+z)}dx \\\\ & = \int_{0}^{1} x \left(\psi(x+1+z)-\psi(x+1)\right) dx \\\\ &=\log \Gamma (z+2)-\int_0^1 \left( \log \Gamma (x+1+z)-\log \Gamma (x+1)\right) dx\\\\ &=\log \Gamma (z+1)-z\log(1+z)+z \end{align} $$ where $\psi:=\Gamma'/\Gamma$ is the digamma function and where we have used Raabe's formula. The previous results give $(1)$.
Remark. If we combine the closed form $(1)$ with Jack D'Aurizio's answer we get a proof for the Stirling formula.