To my knowledge, the best way to (correctly) model a epidemic would be through the analysis of large data sets. Usually this is accomplished through computational modeling (listed a link below). The role of immunity in stopping the progression is a multifaceted question. In developed countries, we relay on herd immunity to provide bulk coverage, however, the exact mechanism by which this proceeds falls predominantly in the field of vaccinology.