Depending on the style of beer you're brewing and the base malt you're using, mash temps have something to do with it. You can maximize head retention by ensuring appropriate protein-related step mash temps (or not doing inappropriate protein rests) as they relate to your malt analysis, if you can get it.