Hi, Annette. As long as you have air and humidity, you can have mildew. The spores are in the air and the humidity is all they need to grow. Bleach will kill the growing mildew and a sponge will remove the dead black stuff, but until you get rid of the moisture, you can have mildew. If you paint under growing mildew or while there is moisture or high humidity, the paint will peel.
Is your fan wired so that it comes on whenever the light is on? If not, have it rewired this way. Where does the fan exhaust? If it exhausts outside, this is OK. If it just exhausts into the attic, this can be a big problem and it may be a big part of your problem.
When you do have to repaint, wash the walls with 1 cup of water to a gallon of bleach, rinse with clear water, then wash again with Tri-Sodium Phosphate (TSP) mixed per label directions. Buy the very best paint that you can find at an independent retail paint store and have them mix in some extra mildewcide. Paint on a day with low humidity and put an exhaust fan in the bathroom doorway blowing out for a couple of hours before you paint. Don't take a long, hot shower for a day before and a day after you paint.