Environmental and demographic drivers of epidemics