Why the standard error of the mean never gets to zero even when the sample has the same size as the population? Why, when we calculate the standard error of the mean for a hypothetical sample with the same size as the population, the value is not equal to zero, if the sample in this case is identical to the population?

The reason that this does not happen is that we apply formula's that assume that the sample size is much smaller than the population size.

A sample is often regarded as taken from an infinite population and, when used as an estimate for the mean of the population, the estimate of the mean of the population has an estimated variance of $$ \text{var}(\bar{x})  = \frac{1}{n-1} \sum (y_i - \bar{y} )^2  $$
This assumes that the population can be regarded as infinite. When this assumption is false then this formula is not correct. And it is also incorrect to state that the variance does not get to zero.
When you estimate the mean of a finite population and you get to sample the entire population, then you can determine the population mean with 100% accuracy and the standard error should be zero.
