One theory is that the acid just cancels out hard water and makes the detergent more effective, but I don't buy that. Seattle water is so soft that home brewers have to add minerals to the water or the yeast won't multiply properly. In fact most of us are using way too much detergent in our laundry and our dishwashers because of it. I've also run out of vinegar enough times and have known this trick for enough years that I know for certain that washing 1x with vinegar always gets the mildew smell out, but 1x without it only works less than half the time.