Imagine, if you will, a tribe of Homo sapiens at the very beginning of the current interglacial. Due to the development and use of their brains they had survived some of the harshest conditions possible.
Now the ice is melting, and the life that lay buried under it slowly returns. There is a supply of food no one had ever dreamt of, and because of the unequalled efficiency man had achieved under the pressure of the ice age this food can be gathered in a fraction of the time it took previously.
Due to his efficiency man had now created something few other creatures knew before: spare time. And while spare time later brings us blessings like philosophy, science and the arts (as well as the carbuncle of religion) this tribe does the only thing known to them: gathering food.
However, they find out that the surplus of food can be used for their purposes. Giving it to the children, the old, the weak, the sick, and - who knows - maybe even the lazy, creates loyalty and dependence and demonstrates their superiority. The more mouths a provider feeds, the more influence he gains within the tribe.
The competition is on. While every provider could feed himself in one or two hours, food is gathered all day to ensure one's position. Finally, every member of the tribe gets fed - but there is still a surplus of food.
Yet the providers need to go on competing (and filling their spare time), so whatever remains after feeding the tribe gets burnt. Some tribe members may feel this is a waste of food, but since they depend on them, they don't speak up as the providers compete for the honour of burning the most food.
Step one is now completed.
Generations pass. The providers still burn food; the tradition is kept alive, although nobody knows the reason behind it any more.
Food got scarce in the meantime. The providers have to ration their dependants' shares, or maybe even exclude certain members they had looked after before.
But the burning of the food takes priority. That's what the elders have taught them, and that's how they do it.
There is a moral outcry against the food burning, and while the tribal leaders won't give in they feel they are under pressure to justify the tradition.
Finally they tell their starving tribe that the food is burnt to make the clouds bring the rain, or to be smelled by the mammoths so they return to this area.
Step two is now completed.
Skip another few generations, and you may find the tribe in dire straits. Even though more food was burnt than ever before, the rain and the mammoths still stay away.
One night, the chief goes to sleep, thinking, 'How can we get the mammoths back, how can we get the mammoths back...'
As he dozes off, his subconscious is going to work. In a dream he sees an enormous mammoth walking up to him and informing him about the only way to bring them back; maybe that they have to build a wooden mammoth which they honour, as to always remind them of their dependency on them, or maybe that they have to burn more personal sacrifices.
The chief tells the tribe of his vision and - voila, the world's first god is born.
The chief will soon realise the power his invisible friend can bestow on him. He can strengthen his position by claiming he has been chosen by the Big Mammoth, and that its wrath would come upon anyone challenging his leadership. He could tell the tribe the Big Mammoth has ordered that the rest of the tribe pay tributes to him, etc. So, while he may even believe in the Big Mammoth himself, he certainly knows how to take advantage of it.