What are the differences between different types of onions, and when do you use them?
The choice of one onion over another is really going to come down to personal preference based on color and flavor.

Red and white onions are usually milder in flavor than yellow onions which is the reason they're often the choice for hamburgers and sandwiches.

Yellow (sometimes referred to as "Spanish") onions tend to have a more pungent flavor.

Sweet onions (Vidalia, Maui, Walla-Walla, Texas 1015) develop more sweetness and fewer sulfuric compounds due to the mineral content of the soil that they're grown in.  This is why you can have onion sets (small bulbs) from any of these varieties but they won't necessarily be sweet (or as sweet) because a lot of it has to do with the makeup of the soiling they're grown in.

Two years ago I hosted Jeanne Jones (syndicated writer of "Cook it Light" column for King Features syndicate and writer of over 33 cookbooks including "Canyon Ranch Spa Cookbook") for guest chef cooking classes.  If I recall correctly, she said she used primarily white onions because they have a lower sodium content than any other type.

Did that "mean black eyed pea salad" recipe happen to come from a certain "Low Country Cooking Class"?  If so, I used it for two reasons:  not everyone will have access to Vidalia onions and it provides additional color.