Gauge theories at finite temperature and the background field method