How is the value of $\lambda$ estimated in Poisson distribution using MLE when the sample is comprised of only 0s?
Imagine we have a sample x = (0, 0, 0, 0, 0) of a Poisson distribution, where $X \sim Po(\lambda)$. The MLE of $\lambda$ is $$\hat{\lambda} = \frac{1}{n}\sum_{i=1}^{n} x_i$$ Therefore, for the sample x = (0, 0, 0, 0, 0), $\hat{\lambda} = 0$. However, by definition of the Poisson distribution $\lambda > 0$.
How is that possible and how is the MLE $\hat{\lambda}$ calculated?
For purposes of maximum likelihood estimation, one should take the parameter space to be closed.
You have $L(\lambda) = \prod_{i=1}^5 \dfrac{\lambda^0 e^{-\lambda}}{0!} = e^{-5\lambda}$ for $\lambda\ge0.$
That is a decreasing function of $\lambda,$ so its global maximum is at the lower endpoint of the parameter space.
Sometimes it seems appalling to see how many people think an MLE is simply a point at which $L\,'=0.$ That neglects the fact that $(1)$ not every critical point is the location of a global maximum, and $(2)$ when a global maximum is at the boundary of the domain, the derivative there need not be $0,$ and $(3)$ there are instances in which the quickest way to find the location of a global maximum does not involve using derivatives at all.
And one may consider a degenerate Poisson distribution that assigns probability $1$ to $\{0\}.$