Factors influencing the spread of religions and languages