Religion in Total War is usually set in place by faction. It began playing a part in Total War in Rome: Total War - Barbarian Invasion. Since then, it has been pre-set in all games but Shogun 2 where factions have a choice to convert their religion in certain circumstances.
For example, the Byzantine Empire in Medieval II would be Orthodox Christianity and would have to compete with the surrounding religions of Islam and Roman Catholicism. Competing religions cause religious dissent within a province and may even cause an uprising in the settlment. Capturing a province of similar belief lessens disorder. Priests of Roman Catholicism or the equivalent in other religions can spread their religion, either within your own province to promote order, or within an enemies to promote uprising.
In Medieval II, these religions are Roman Catholicism, Orthodox Christianity, and Islam. Two minor roles are Heretic and Paganism.
Empire: Total WarEdit
Religion in Empire: Total War plays a smaller role than in previous games. If a region has a large proportion of population that follow a different religion from the faction that controls it, then the region suffers religious unrest, resulting in a decrease in public order. Populations may be converted by religious agents and buildings: the larger a population is, the slower it converts. Religion buildings grant a happiness bonus to regions where a significant portion of its population follow the faction's religion. Religion buildings that are not affiliated with the faction, however, do nothing to increase population happiness.
Certain religions conflict more than others. A largely Catholic population, for example, is largely tolerant of a Protestant government (generating at most 3 unrest). A Muslim population, however, is much unhappier with a Protestant government (up to 8 unrest).
Researching Secular Humanism halves the effect of religion, decreasing religious unrest but also reducing the happiness bonus provided by religion buildings.
Religion also plays a minor role in diplomacy. Factions with the same religion have a slightly more positive relationship with each other, but suffer a penalty if their religious affiliations are different.
Napoleon: Total WarEdit
Religion is still present in Napoleon: Total War, with regions having similar religious denominations as their incarnations in Empire: Total War. Unlike Empire: Total War however, there is no way to convert the populace, and religious agents and buildings are absent. With this in mind, factions have a slightly easier time invading regions of a similar religion to themselves, and there's no way to decrease religious unrest. In general, however, religion plays an even smaller role that in Empire: Total War, rarely being enough to cause newly-acquired regions to rebel.
Religion plays a similar role to what it did in previous games in terms of politics: factions that share religions have a bonus to their relations, while factions with differing religions suffer a penalty in diplomatic relations. There is no way to change the religion of a faction.
In the Peninsular Campaign, religion is replaced by pro or anti-French sentiment. Populations are converted to either cause with the use of Provocateurs, which operate similarly to priests from previous games.