Mildew flourishes in moist areas and thrives on organic matter. Therefore places such as bathrooms or kitchens that are high in humidity and receive minimum sunlight are seen to contain mildew. If you use an alkyd or oil-based paint, you may find mildew growing on it, as mildew uses the oil as food. Poor quality latex paints also attract mildew. If wood is not primed before paint is applied on it, you may find mildew growing on it soon. This is because probably the mildew existed before you painted the wood.
All brown, black or gray spots may not be due to mildew. Therefore you must test if mildew is really present in the area with some household bleach. Apply the bleach on the spotted area. If the spot disappears, mildew may be present. The next step is to remove the stubborn mildew. Scrub the area with a diluted solution of bleach and water in the proportion of 1:3. Rinse with water and allow the area to dry completely. Use a good mildew resistant paint. Reduce moisture by installing an exhaust fan.