Once one gets past the first 100 pages, Dennett’s Breaking the Spell book picks up. A lot of it, as he makes clear, is speculation: 

I will try to tell the best current version of the story science can tell about how religions have become what they are. I am not at all claiming that this is what science has already established about religion. The main point of the book is to insist that we don’t yet know — but we can discover — the answers to these important questions if we make a concerted effort. (p. 103)

It’s helpful to keep this qualifier in mind when Dennett makes some of the specific claims he does about how religious-type beliefs arose:

Why did those with the genetic tendency survive? Because they, unlike those who lacked the gene, had health insurance! In the days before modern medicine, shamanic healing [i.e., placebo-effect healing] was your only recourse if you fell ill. If you were constitutionally impervious to the ministrations that the shamans had patiently refined over the centuries (cultural evolution), you had no health-care provider to turn to. (p. 140)

This sort of explanation is open to the standard charges raised against evolutionary psychology (for example, that they are telling just-so stories, with no empirical ground). But with Dennett’s qualifier that I quoted above, he has a promising response — yes, so far, this is a just-so story; more research needs to be done. (This leads to the natural question of whether more research can be done — I’m hoping that issue will be taken up later in the book.)