I believe the following excerpt from a speech given by Douglas Adams (Writer of the Hitchhikers Guide to the Galaxy, atheist) in 1998 sums up a fairly straightforward and plausible mechanism to how human beings started developing the notions of gods/deities
"Where does the idea of God come from? Well, I think we have a very skewed point of view on an awful lot of things, but let's try and see where our point of view comes from. Imagine early man. Early man is, like everything else, an evolved creature and he finds himself in a world that he's begun to take a little charge of; he's begun to be a tool-maker, a changer of his environment with the tools that he's made and he makes tools, when he does, in order to make changes in his environment. To give an example of the way man operates compared to other animals, consider speciation, which, as we know, tends to occur when a small group of animals gets separated from the rest of the herd by some geological upheaval, population pressure, food shortage or whatever and finds itself in a new environment with maybe something different going on. Take a very simple example; maybe a bunch of animals suddenly finds itself in a place where the weather is rather colder. We know that in a few generations those genes which favour a thicker coat will have come to the fore and we'll come and we'll find that the animals have now got thicker coats. Early man, who's a tool maker, doesn't have to do this: he can inhabit an extraordinarily wide range of habitats on earth, from tundra to the Gobi Desert - he even manages to live in New York for heaven's sake - and the reason is that when he arrives in a new environment he doesn't have to wait for several generations; if he arrives in a colder environment and sees an animal that has those genes which favour a thicker coat, he says “I'll have it off him”. Tools have enabled us to think intentionally, to make things and to do things to create a world that fits us better. Now imagine an early man surveying his surroundings at the end of a happy day's tool making. He looks around and he sees a world which pleases him mightily: behind him are mountains with caves in - mountains are great because you can go and hide in the caves and you are out of the rain and the bears can't get you; in front of him there's the forest - it's got nuts and berries and delicious food; there's a stream going by, which is full of water - water's delicious to drink, you can float your boats in it and do all sorts of stuff with it; here's cousin Ug and he's caught a mammoth - mammoth's are great, you can eat them, you can wear their coats, you can use their bones to create weapons to catch other mammoths. I mean this is a great world, it's fantastic. But our early man has a moment to reflect and he thinks to himself, 'well, this is an interesting world that I find myself in' and then he asks himself a very treacherous question, a question which is totally meaningless and fallacious, but only comes about because of the nature of the sort of person he is, the sort of person he has evolved into and the sort of person who has thrived because he thinks this particular way. Man the maker looks at his world and says 'So who made this then?' Who made this? - you can see why it's a treacherous question. Early man thinks, 'Well, because there's only one sort of being I know about who makes things, whoever made all this must therefore be a much bigger, much more powerful and necessarily invisible, one of me and because I tend to be the strong one who does all the stuff, he's probably male'. And so we have the idea of a god. Then, because when we make things we do it with the intention of doing something with them, early man asks himself , 'If he made it, what did he make it for?' Now the real trap springs, because early man is thinking, 'This world fits me very well. Here are all these things that support me and feed me and look after me; yes, this world fits me nicely' and he reaches the inescapable conclusion that whoever made it, made it for him.
This is rather as if you imagine a puddle waking up one morning and thinking, 'This is an interesting world I find myself in - an interesting hole I find myself in - fits me rather neatly, doesn't it? In fact it fits me staggeringly well, must have been made to have me in it!' This is such a powerful idea that as the sun rises in the sky and the air heats up and as, gradually, the puddle gets smaller and smaller, it's still frantically hanging on to the notion that everything's going to be alright, because this world was meant to have him in it, was built to have him in it; so the moment he disappears catches him rather by surprise. I think this may be something we need to be on the watch out for. We all know that at some point in the future the Universe will come to an end and at some other point, considerably in advance from that but still not immediately pressing, the sun will explode. We feel there's plenty of time to worry about that, but on the other hand that's a very dangerous thing to say. Look at what's supposed to be going to happen on the 1st of January 2000 - let's not pretend that we didn't have a warning that the century was going to end! I think that we need to take a larger perspective on who we are and what we are doing here if we are going to survive in the long term."
A transcript of the speech can be found here and since I find the other sections of it to be rather interesting as well, I figure that ya'll might want to read the whole thing.