So, What kind of yarn should you use? I would say that you should stick to a few guidelines.
Washable
Before the hats are donated the hats are washed in dye and fragrance free detergent.
Machine Dried
Placed in a Zip Lock Bag.
Not sure how to tell if your hat is washable, check the tag on the yarn:
Think Texture
If it doesn't feel soft, maybe use it for another project. If you aren't sure, try knitting a small swatch and throw it in the wash, sometimes yarns show their true texture after washing.
ALong with being soft, some yarns get really "pilly", you know what I mean, those ugly balls that show up? If you've knit with something that pills, sometimes not great for a hat.
Why? Well, when you go into the hospital fo chemo treatment, all of your clothes have to be washed again once you get home. They even recommend washing it 2 or 3 times. If a child gets a slight cold, yup, into the wash again. A lot of laundry gets done, if your hat it the favorite, it's going to get washed a LOT.