Having brain surgery, craniotomy. Do I have to remove my nail polish? If so all of it? And why?

Generally not. You will need to have an oxygen probe placed on one of your fingers for the operation and in the ICU post op. Some nail polish interferes with the sensor. If you have artificial nails, they may ask you to remove them if possible as they can harbor bacteria as well.
Pulse ox. When you have surgery, they connect you to a machine that reads your blood oxygen saturation. This pulse oximeter is attached to your finger and nail polish can interfere with the reading. It would be best to remove nail polish from all your fingers so they don't have to check every finger to see which one is not polished. You can reapply nail polish after your surgery.