Well, Maui brewing does it in all 3 phases (to my knowledge): Mash, boil, and secondary.
I typically add mine to the keg post-fermentation, this allows me more control. I add it in a couple of hop sacks with weights. Anywhere from 0.5-1.5lbs/5gallons. It usually takes anywhere from 3-14 days depending on the style of beer and the amount of coconut added.. I generally toast it in the oven on the lowest bake setting for 10-15 minutes with frequent stirring until golden brown (the house smells fantastic, BTW!), before adding it to the beer. You want to use the organic stuff, not the coconut you find in the baking aisle.
I have never had a head retention issue with the coconut in a beer in the past. My guess is that the oil floats on the beer and I serve from a keg, so I am pulling the beer from underneath the oil? Just a hunch.
Many people also use extract dosed to taste with great success as well. I recommend Olive Nation. All of their extracts are top notch!