Last time I was discussing with a physicist about quantum field theory and how in the firsts chapters of textbooks it is often regarded that the Klein-Gordon equation does not have a positive definite inner product/probability density. He told me that he had seen a book that obtains a positive probability density. The author just change the sign with a factor $\epsilon(p^0)$ but I cannot understand what he is doing. The book is Fields by Warren Siegel https://arxiv.org/abs/hep-th/9912205
On page 323 he says
where the $\epsilon(p^0)$ appears because the contour integral gives a + at later times (positive energy) and a − at earlier times (negative energy).
Could someone help out with an explanation of why there is a contour integral producing a $\epsilon(p^0)$ factor?