This question always arises when people hear about the ideas of socialism, communism and genuine equality. And the answer is not a very straighforward one.
First, the difference between communism and socialism must be made clear.
Communism is a classless society, with no class divisions whatsoever, and society would operate on the motto: "From each according to his ability, to each according to his need." Socialism, by contrast, is the bridge between capitalism and communism, between a society of massive inequality and a society that has abolished inequality. Socialism is the "revolutionary dictatorship of the proletariat", i.e. where workers seize the means of production, smash the capitalist state, build their own state, and run the whole of society on the basis of human need democratically from below.
Now that we have established the difference between the two, we can begin to answer the question.
Under socialism, society would function according to the motto: "He who does not work, does not eat." The exception being, of course, mentally disabled people, small children, old people, and those with some sort of disability. But every able-bodied man and woman would have to get a job, otherwise they wouldn't receive any of the goods society produced.
Pay would probably be determined by society's overall need. If we had too many garbagemen, for example, we'd have to pay them less, in order to compel people to take jobs that were more needed. Pay would probably also be determined by how enjoyable or miserable the job is. So perhaps garbagemen would make more than doctors since their job involves handling filth, muck, and garbage.
"Well what's the incentive to be a doctor?"
In today's society, what's the incentive to be a doctor? Money! In tomorrow society, what's the incentive to be a doctor? The joy of helping and caring for others. Would you rather have a doctor who was in it just for the money, or a doctor who genuinely cared for you? There are people today who are doctors for the latter reason, who choose to work in low-income, inner city hospitals or in the Third World, or who decide not to be plastic surgeons but instead become pediatricians. Their ranks will only swell once capitalism has been overthrown.
The other point is that under socialism no one would be pigeon-holed into one profession or another. A doctor could also pick up the trash, say every other Wednesday morning. Most crappy jobs could be divided among society's members more or less equally. Those that cannot would have to be paid more in order to motivate people to do them.
In the process of ending poverty and developing people's talents in an all-around way, it won't matter who is paid what, since most people's needs are basically the same, and those needs will be met by society. No one would make $10,000 a year while another made $1,000,000 a year, for example. The gross inequalities of class society would give way to general equality, in the transition from capitalism to communism.
If you are looking for specific answers and blueprints for socialism, you will be gravely disappointed because socialism has to be built by the workers themselves. I have only outlined here in general what a society run democratically by the vast majority might look like.