Formally, I see it as emerging from the trace necessary to compute observables in quantum mechanics,
⟨O(t)⟩=Tr[ρO(t)].
I use Heisenberg's picture, O(t)=eitHOe−itH and ℏ=1. The path integral representation of the time evolution operator gives
⟨x|eitH|x⟩=∫DxeiS,
with S=∫t0dt[...] an action that contains a simple time integral from t=0 to t=t. In thermal equilibrium, you can set it=−β and compute observables from
⟨O⟩=Tr[e−βHO].
There is only one time path. Out-of-equilibrium however the two terms e±itH must be taken into account. Each leads to the same action. Only the direction of time changes. The full expression for the time dependent observable is
⟨O(t)⟩=∫dxdx′dx″dx‴×<x|ρ|x′><x′|eitH|x″><x″|O|x‴><x‴|e−itH|x>,=∫Dxei[S++S−]<x−(0)|ρ|x+(0)><x+(t)|O|x−(t)>,
where S+=∫t0dt[...], S−=∫0tdt[...] and x±(t) are the paths on the forward and backwards paths respectively. The integrals over the boundaries, x=x(0), x′=x(0) x″=x(t) and x‴=x(t) have been absorbed into the functional integral, ∫Dx.
This is a very quick answer. Tell me if you have trouble filling in the gaps. The generalisation from quantum mechanics to quantum field theory is straightforward.