The sample size formula depends on the test that you want to carry out. The one you mention looks like a Questionnaire/Survey study type. In this formula, there are assumptions on whether the studied population will lie or will respond incorrectly. This is expressed by the margin of error. 

This article: [Sample size, power and effect size revisited: simplified and practical approaches in pre-clinical, clinical and laboratory studies][1] C.C Serdar, M.Cihan, D. Yucel, M.A. Serdar (2021) provides very helpful information about it.

"The margin of error expresses the amount of random sampling error in the survey results".

You will see in this article that even if the population is unknown, an approximation is enough since the sample size tends to increase less when the population size gets bigger.

[![enter image description here][2]][2]

The example that you gave (new disease) is not a questionnaire/survey type nut more a test for proportions which uses a different [sample size formula][3] in which the population size is not involved, but power is.

in R, this can be done using the [power.prop.test][4] function or through the package [pwr][5] which offers the same possibilities.


  [1]: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7745163/
  [2]: https://i.sstatic.net/JL1Lt.png
  [3]: https://www.itl.nist.gov/div898/handbook/prc/section2/prc242.htm
  [4]: https://www.rdocumentation.org/packages/stats/versions/3.6.2/topics/power.prop.test
  [5]: https://cran.r-project.org/web/packages/pwr/vignettes/pwr-vignette.html