Stuck in math showing relationship between poisson and exponential distributions

Given that

$X \sim \operatorname{exponential}(1)$

$\operatorname{Pr}(X>s+t \mid X>s)=\operatorname{Pr}(X>t)$

$Z_k$ denotes the waiting time for k successive events and $Z_k \sim \operatorname{gamma}(k,1)$.

We are asked to prove that the number of events that occur in a particular time $t$ follows poisson distribution.

The solution provided goes as follows:

Let $X \sim \operatorname{exponential}(1)$ be the waiting time for the $(k+1)^{th}$ event.

$\operatorname{Pr}($ exactly $k$ events occur in time $t)= \operatorname{Pr}\left(Z_{k} \leqslant t, Z_{k+1} \gt t\right) = \int_{0}^{t} \operatorname{Pr}\left(Z_{k}=z\right) \operatorname{Pr}(X>t-z) d z$

I can't understand how the integral equation follows from the previous equation mathematically. How can I use laws of probability to get to the integral equation?


We want the probability that the next arrival occurs after time $t$, given that it occurs after an arrival that occurs at time $z$ .

$$\begin{align}\Pr(Z_{k+1}>t\mid Z_k=z)&=\Pr(X>t\mid X>z)\\[1ex]&=\Pr(X>t-z+z\mid X>z)\\[1ex]&=\Pr(X>t-z)\end{align}$$


Thus $$\begin{align}\Pr(Z_{k+1}>t, Z_k\leqslant t)&=\int_0^t f_{Z_k}(z)\,\Pr(Z_{k+1}>t\mid Z_k=t)\,\mathrm dz\\[1ex]&=\int_0^t f_{Z_k}(z)\,\Pr(X>t-z)\,\mathrm dz \end{align}$$