Poorly cleaned glasses can definitely kill your head retention. Recipe and your method of dispensing can affect the formation of head as well. There is no difference between keg/bottle/can as far as head retention goes.
The reason we want head on our beer is that it's basically a billion little bubbles constantly hitting the surface, rising up, and exploding. All those bubbles and explosions mean more beer/air surface area which means more aroma. Since aroma is such a huge component of our flavor perception, we get a much more complete and enjoyable sense of the beer we're drinking.