Most people think that the mayonnaise in potato salad is the culprit that wreaks digestive havoc. Not so, since the eggs used in commercial mayo are pasteurized to kill bacteria and bacteria doesn't fare well in an acidic environment e.g. vinegar ensuring mayo is rarely the problem(even homemade). It is more likely to be the potatoes. The Staphylococcus bacteria which are common in soil and dust thrive on starchy food like rice or potatoes and can find their way to your salad via unwashed veggies, cutting board or contaminated hands.
Food-borne bacteria grow at temperatures between 40˚ - 140˚F so the US Food and Drug Administration recommends refrigerating food wihtin two hours of preparation or one hour if room temperature is over 90˚. Promptly refrigerate leftovers in a covered container is also suggested.