One, I remember a study back when cigarette companies were told they couldn't advertise on television that all major tobacco brands loved this because it meant they didn't have to spend any money on these types of ads. I'm sure there are versions of this all over the place in most marketing strategies.
Two, pardon my cynicism, but I'm sure companies model these things out and take action based on those models. No CEO is just like "yes, let's support a social cause." Randomly picking on a brand, but I'm sure Starbucks started flying a Pride Flag because it made sense to do so for the business.