Mozilla Foundation for example gets tons of money from Google. The Apache Software Foundation gehts a huge amount of donations from these people: http://apache.org/foundation/thanks.html
We are speaking of huge amounts of money here.
In case of jQuery, look here: http://jquery.org/sponsors/
Of course, most people in these foundations are not paid. F. e. the ASF does not pay a single developer. Many developers in open source projects do it because it is fun. And it is good on their CV. People who are experts with jQuery do get some good jobs indeed.
If you found a company with the open source model, you need to pay your developers. For example, IBM pays people to develop OpenOffice.org, even when it is an Apache Software Foundation project meanwhile.
Why? Because they can sell Support to their customers. Or trainings.
Many companies who develop open source products give support and traiing, or additional It is the way big cos like Red Hat work or even smaller companies.
But yes, basically most projects start with a few hackers sitting in a cafe and having an idea.
Please have in mind that sometimes you could think that an open source foundation like the ASF is somehow a playground where different companies can play together without much politics. Because at the ASF there are individuals only, not companies. If these individuals are paid by companies... no problem. Please be aware the the ASF is very carefully about project independence from companies, even when my comment didn't read very much like that :-)