Nielsen-Schroer analysis of the chiral anomaly including temperature and higher dimensions