How do I show that as $z \to \infty$ that $\int_0^\infty \frac{t - \lfloor t \rfloor - 1/2}{z + t} dt = O(z^{-1} )$?? 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.
 A: There is a closed form of your integral.
Proposition. Let $z$ be a complex number such that $\Re z>0$. We have

$$
\int_0^\infty \frac{t - \lfloor t \rfloor - 1/2}{z + t} dt=-\log \Gamma (z+1)+(z+1/2)\log z-z+\frac12\log (2\pi) \tag1
$$

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.
A: $f(t)=t-\lfloor t\rfloor-\frac{1}{2}$ is a $1$-periodic function with mean zero on every period, and $\frac{1}{z+t}$ is a function slowly decreasing towards zero. Then, just prove that for any $u\in\mathbb{R}^+$
$$ F(u) = \int_{0}^{u}f(t)\,dt \in\left[-\frac{1}{8},0\right] $$
and use integration by parts, or the second mean value theorem for integration.
A: It's also possible to obtain a complete asymptotic expansion for this integral (and hence obtain the asymptotic expansion for $\log\Gamma(z+1)$).
The quantity $t-\lfloor t \rfloor - 1/2$ is a sawtooth wave and has the known Fourier series
$$
t - \lfloor t \rfloor - \frac{1}{2} = - \frac{1}{\pi}\sum_{k=1}^{\infty} \frac{\sin(2\pi k t)}{k}.
$$
We can substitute this series into the integral and exchange the order of integration and summation; indeed, if we set $f(t) = t-\lfloor t \rfloor - 1/2$ and
$$
f_n(t) = - \frac{1}{\pi}\sum_{k=1}^{n} \frac{\sin(2\pi k t)}{k}
$$
then, using integration by parts,
$$
\begin{align}
\left|\int_0^\infty [f(t) - f_n(t)] (z+t)^{-1}\,dt \right| &= \left| \int_0^\infty (z+t)^{-2} \int_0^t [f(s)-f_n(s)]\,ds\,dt \right| \\
&= \left| \int_0^\infty (z+t)^{-2} \int_0^{\{t\}} [f(s)-f_n(s)]\,ds\,dt \right| \\
&\leq \int_0^\infty (z+t)^{-2} \int_0^1 |f(s)-f_n(s)|\,ds\,dt \\
&= z^{-1} \|f-f_n\|_{L^1([0,1])} \\
&\to 0
\end{align}
$$
as $n \to \infty$, where $\{t\} = t - \lfloor t \rfloor$.  Thus
$$
\begin{align}
\int_0^\infty \frac{t - \lfloor t \rfloor - 1/2}{z + t} \,dt &= -\frac{1}{\pi} \sum_{k=1}^{\infty} \frac{1}{k} \int_0^\infty \frac{\sin(2\pi k t)}{z+t}\,dt \\
&= -\frac{1}{\pi} \sum_{k=1}^{\infty} \frac{1}{k} \int_0^\infty \left(1+t^2\right)^{-1} e^{-2\pi k z t}\,dt, \tag{1}
\end{align}
$$
where the second equality follows from [1] (see also [2, pp. 187-188]).  For each $k$ we have
$$
\int_0^\infty \left(1+t^2\right)^{-1} e^{-2\pi k z t}\,dt \sim \sum_{n=0}^{\infty} \frac{(-1)^n (2n)!}{(2\pi k z)^{2n+1}}
$$
by Watson's lemma.  This asymptotic series can be interchanged with the convergent series in $(1)$ and remain asymptotic, thus
$$
\begin{align}
\int_0^\infty \frac{t - \lfloor t \rfloor - 1/2}{z + t} \,dt &\sim -\frac{1}{\pi} \sum_{n=0}^{\infty} \frac{(-1)^n (2n)!}{(2\pi z)^{2n+1}} \sum_{k=1}^{\infty} \frac{1}{k^{2n+2}} \\
&= - \frac{1}{\pi} \sum_{n=0}^{\infty} \frac{(-1)^n (2n)! \zeta(2n+2)}{(2\pi z)^{2n+1}} \\
&= -\sum_{n=0}^{\infty} \frac{B_{2n+2}}{(2n+1)(2n+2) z^{2n+1}} \\
&= - \frac{1}{12 z} + \frac{1}{360 z^3} - \frac{1}{1260 z^5} + \frac{1}{1680 z^7} - \cdots.
\end{align}
$$
This agrees with the known asymptotic for $\Gamma(z+1)$ in light of the result in Oliver's answer.

[1] DLMF Eqn. 6.7.13
[2] N. Temme, Special Functions: An Introduction to the Classical Functions of Mathematical Physics, Wiley, 1996.
