Cross-posted to the EA Forum.
Epistemic status: speculating, hypothesizing
At first approximation, there are two types of motivation for acting – egoistic & altruistic.
Almost immediately, someone will come along and say "Wait! In fact, there's only one type of motivation for acting – egotistic motivation. All that 'altruistic' stuff you see is just people acting towards their own self-interest along some dimension, and those actions happen to help out others as a side effect."
(cf. The Elephant in the Brain, which doesn't say exactly this but does say something like this.)
In response, many people are moved to defend the altruistic type of motivation (because they want to believe in altruism as a thing, because it better matches their internal experience, because of idealistic attachments; motivations vary).
I'm definitely one of these people – I think the altruistic motivation is a thing, distinct from the egoistic motivation. Less fancily – I think that people sometimes work to genuinely help other people, without trying to maximize some aspect of their self-interest.
Admittedly, it can be difficult to suss out a person's motivations. There are strong incentives for appearing to act altruistically when in fact one is acting egotistically. And beyond that, there's a fair bit of self-deception – people believing / rationalizing that they're acting altruistically when in reality their motivations are self-serving (this gets confusing to think about, as it's not clear when to disbelieve self-reports about a person's internal state).
Here's a potential heuristic to help determine when you're acting altruistically or egotistically – altruistic action tends to be dispassionate. The altruist tends to not care very much about their altruistic actions. They are unattached to them.
It's a bit subtle – an altruistic actor still wants things to go well for the situation they're acting upon. They're motivated to act, after all. But that care seems distinct from caring about their actions themselves – considerations about how they will be received & perceived.
The locus of their care is in the other people involved in the situation – if things go better for those people, the altruist is happy. If things go worse, the altruist is sad. It doesn't matter who helped those people, or what third parties thought of the situation. It doesn't matter who got the credit. Those considerations are immaterial to the altruist. They aren't the criteria by which the altruist is judging their success.
This heuristic doesn't help very much for determining whether other people are acting from altruistic or egotistic bases (though if you see someone paying particular attention to optics, PR, etc., that may be a sign that they are being more moved by egotistic considerations in that particular instance).
I think this heuristic does help introspectively – I find that it helps me sort out the things I do for (mostly) altruistic reasons from the things I do for (mostly) egotistic reasons. (I do a large measure of both.)