Let $X_1, X_2, \dots$ be $\mathcal E(\theta)$ distributed random variables, let $N \sim \mathcal P(λ)$, and suppose that all random variables are independent.
Let $Y = \max\{X_1,X_2, \dots ,X_N\}$ with $Y=0$ for $N=0$.
Show that $Y=\max\{0, V\}$, where $V$ has a Gumbel type distribution.
Remark. The cumulative distribution function of the standard Gumbel distribution equals $h(x) = \exp(−e^{−x})$, $\forall x\in]-\infty, +\infty[$.
Conditioning on $N$, and using the fact that $N$ is independent of $Y$, $P(Y\le a\mid N)=(1-e^{-\theta a})^N.$ That is what you calculated in the case $N=5$. The independence of $N$ and $Y$ licenses the substitution of the random variable $N$ for 5.
So $P(Y\le a)=E(P(Y\le a\mid N))=E((1-e^{-\theta a})^N)=e^{-\lambda}\sum_{i=1}^\infty (1-e^{-\theta a})^i\lambda^i/i!=exp(-\lambda e^{-\theta a}).$