Sorry if this isn't a correct place to ask this question. I don't understand how non-profit organization exist in capitalism because how do they sustain themselves? How do they pay their workers if they aren't generating any profit? Isn't it just volunteering?
A lot of non-profits function as a tax avoidance scheme. They're set up to do, say, some local or international social service as a charity, get donations, and the donors can write these donations off their taxable income. There are also non-profits that produce something and share all proceeds among the workers, but my perception is that those are far less common than the charitable type.
A lot of wealthy people start up their own non-profits as well, so they can "donate" to their own non-profit, write off the donation, and still control where the money is spent.
In any case the workers do typically earn money, but it's often less than they'd get doing a similar job for the state or a For-profit company.