The religion mechanic is not clearly described in the game itself.
Every city has an invisible "follower count" for each religion (which includes pantheons and "no religion" aka "atheism").
Citizens start as atheists.
If city A has Islam and city B is within 10 spaces of it, the religious pressure from A to B is +6 (on normal speed), which means that city B's follower count for Islam will increase by 6 per turn.
Using a Missionary's "spread religion" will add its strength (usually 1000, but can be depleted by Unwelcome Evangelists or increased by an enhancer belief) in followers to that city.
I forget the exact formula of followers to citizens (which is sort of like asking how many "atheist followers" a city has). I think it's 100 followers per citizen.
So if I'm right about it being 100, if a city has 1 population, it will have "no religion" until some religion's follower count passes 100, when the city will switch to that religion.
I think, whenever a city grows in population, the existing follower counts are scaled upward. So if a newly founded city starts with 100 atheists, gets up to 24 Christians from four turns of +6 pressure, then the city grows to size 2, the city's follower count will now be 200 atheists, 48 Christians.
The citizens of a city are proportionally divided among the religions with non-zero follower counts. So if a size-10 city has 1000 atheist followers, 2000 Islam followers, and 2000 Christianity followers, the tooltip will show "4 Islam, 4 Christianity".
Finally, an Inquisitor or Great Prophet resets the follower count for all religions other than its religion to ZERO. You can see how this becomes the only feasible way to flip a city that has been receiving religious pressure from nearby cities for hundreds of turns. A city could have a Christianity follower count of 20,000. A Muslim Missionary adding 1,000 followers of Islam will result in 1/20th of the follower count being Islam, which definitely won't show up as a single citizen following Islam in a city under size 20.