Research scientists work either for a university, who pays them with the money they get from student fees, government spending, etc. Or they work for a private company who pays them to research something. Lots of medical research exists because drug companies paid for it. Which has its downsides–it tends to mean that negative results don’t get published. The ‘vaccines cause autism’ theory got popular because Andrew Wakefield was paid by a vaccine company to make a rival vaccine look bad, and he didn’t care about getting honest results.
Academics mostly don’t get paid for publishing their papers. It’s just part of their job–they get paid to research, and are expected to publish some of what they research. If they’re at a university they’ll also often be expected to take on teaching jobs. If you study for a science degree, your lecturers aren’t people who trained as teachers, they’re academics.
Same goes for philosophy–academic philosophers are paid by universities to work for the University, teach students, and write papers on philosophy.
Latest Answers