Since they are historical entities, religions are born and die. I'll think about their death some other time. But how do they emerge, and from what? This isn't a question with a single answer, although there are a couple of popular stories about the process left over from the 19th century.

It's widely believed, for example, either that religions must have a charismatic founder, a prophet figure, or that they are more or less self-conscious frauds perpetrated by a priestly class against the common people. This second version is clearly a secularised version of the Protestant history of the Reformation, and makes very little sense as a general theory. Obviously there have been examples of both types of religion formation. It's possible that Mormonism combines both, since a charismatic founder managed to create a social structure with huge rewards for the priesthood. But there are too many exceptions for these rules to be generally valid.

Robert Bellah's account of the emergence of religion might be said to break off just at the point when it becomes easy to talk about the emergence and existence of particular religions, distinguished clearly from other forms of social activity. The very earliest religions are, in Bellah's telling, indistinguishable from culture. He follows Emile Durkheim and most anthropologists in seeing "religion" as an intensification of ritual first of all. The things that everyone in the tribe does together, and the stories they tell together become their religion – or at least what anthropologists could study and classify as religion.

It's not at all clear that the people studied by anthropologists would understand this distinction. They certainly don't understand it theologically. There is a good attack on these kinds of misunderstandings in Pascal Boyer's book The Naturalness of Religious Ideas, in which he points out that most anthropological accounts of "primitive beliefs" refer to something that does not actually exist: "They [are not] thoughts that occur to actual people; they describe thoughts that people might entertain, in the anthropologist's view, if they wanted to make sense of what they actually do and say."

Bellah, with his stress on ritual and on the embodiment of beliefs in wider systems of meaning, avoids this pitfall. You make sense of what you do and say by acting on it, and embodying it in a larger narrative, not by extracting it into a system.

Yet systems do emerge, and they form a large part of what we now think of as religion. Although some form of healing ritual, and healing specialist, seems to have been among the very earliest precursors of religion, and of priesthood, the emergence of any kind of "religion" organisationally distinct from the rest of culture depends at the very least on agriculture, which provides enough of a surplus in fixed settlements.

It seems certain that religions, like other social forms, evolve: that is to say they arise from modifications of earlier forms. The trouble for historical inquiry is simply that without written records we simply have to guess what happened. With written records, we need no longer guess, but can be authoritatively misled. Two excellent accounts of this process are Tom Holland's book In the Shadow of the Sword, about the invention of Islam, and Jim Macdonald's blogpost on the emergence of the Bible as fan fiction.

In those religious systems we know about, there seem to be two processes under way. The first is a kind of coalescence of folk beliefs and practices into something more or less organised and more or less useful to the state. Shinto looks like that, and Hinduism. You could make a case that American Protestantism, which has increasingly less to do with historic, Orthodox Christianity, is heading in the other direction.

Then there are the religions that can be traced back to a single charismatic founder – most obviously Christianity and Islam, but also Sikhism and Mormonism, to name two modern successes.

In all these cases, there is considerable doubt about the relation of the teacher to the teaching subsequently encoded in their name (as with Marx and Marxism), but it does seem that the idea of the perfect teacher helps to spread teachings. The best illustration of that is Judaism, which seems to have been a coalescence or codification – with considerable distortions – of a folk religion recollected in exile, but which was codified around the almost entirely invented figure of Moses.

It seems intuitively obvious that in the modern world, where people must make a self-conscious choice of religion or belief system, a charismatic founder figure who can say "follow me" is necessary. But like many things intuitively obvious, this is wrong. Even today, the most interesting religious movements are those that coalesce without a single founder or a body of organised doctrine – Rastafarianism is a small example, charismatic Christianity a much more important one. There are still religions being born that will change the world.