I toast the coconut and add it to the secondary. Shredded or flaked will work just fine. I have read Maui brewing adds it in the mash, boil, and secondary. But, I can't get them to confirm this. I have heard of people using coconut extract with good success as well. Use the organic stuff that is free of preservatives. You can usually find this in the organic section of your local market or some place like Whole Foods.
I would not use coconut milk as this can get rancid.
As for the myth that coconut affects heard retention due to oils, I can state this as false! If anything, this may help? I have made my award winning coconut porter 3 times with over 2lbs/10gallons and the head retention that I get on my beers is only exceeded by IPAs and some Belgians. So, add the coconut without fear of losing head retention.