How do we know?
For one, religious behavior is a human universal - it is observable among people in all human societies known to us (since at least the middle paleolithic). Even totalitarian, atheistic regimes have not been able to wipe out religiosity - instead, they developped quasi-religious behavior themselves (as by ritually venerating deceased leaders, simulating omnipresence by pictures and monuments etc.). Of course, there's great individual and sociocultural variation in religious behavior, some people abstaining from it consciously and others never having had the chance to acquire much of it - exactly as we observe it with music and language. You can lose interest in all of these heritable traits, but if you didn't even learn to develop them as a kid, you'll seldom get an expert as an adult.
And second, we have a whole bunch of Twin Studies as presented by Thomas Bouchard and Laura Koenigs, which are measuring observable differences between genetic Twins reared together and apart. And they discover percentages of heritability of many human traits as Intelligence, Musicality - and Religiosity (40 - 60%).
If you think about it, that's the finding we would expect. Through evolution, religiosity became a part of human nature. And the process is going on, as in all free societies, religious people tend to have (on average) more offspring than their secular neighbours of the same educational and income classes.