Consider the following code
\documentclass{amsbook}
\usepackage{amsmath}
\usepackage{amssymb}
\begin{document}
\[
E(X) = \delta \left[ \frac{1}{-\delta} x e^{-\delta x} \left| \right|_0^\infty \ldots \right]
\]
\end{document}
It produces the following, which looks odd:
Reversing the order of the middle \left|
and \right|
solves the problem, but only partially (note the differently-sized final delimiter):
\[
E(X) = \delta \left[ \frac{1}{-\delta} x e^{-\delta x} \right|_0^\infty \left| \ldots \right]
\]
Why is that? Is there an appropriate way to do this?