short quick answer:
for the UN, you get one vote for each population, as counted by adding up the populations of your cities, looking from the outside. it says size 5, it counts as 12, so if you have five size 12 cities, you get 60 votes. if you add up the populations of the cities on the map, assuming you know about all (or close enough) the cities, that will tell you how many you get relative to others. that's for the UN of course, AP is more of a pain since it's only cities with the religion, and full members get double votes.
my usual long rambling stuff:
the F9 demographics use a different way to calculate population, they use the "real population" shown when you hover over the city name in the city screen, where it'll say 20,000 citizens or 12 million citizens or whatever. i think a single size 25 city is worth more, in F9 terms, than five size 12 cities are. so you can in theory be #1 in population by F9 demographics definition but not necessarily be #1 in population by UN definition

.
i
think the UN counts population the same way the F8 domination victory condition does, and that if F8 says you have more than 50% population you're a guaranteed candidate. i
know that F8 doesn't go by the F9 definition, and i
know that the UN doesn't go by F9. so completely ignore F9 for the UN and the AP, it can't help you figure anything out, it can only confuse you. i just mention it because i've seen it confuse people in the past.
in BtS, after the UN has been built and a vote's been held, the "Members" tab on F8 tells you how many votes each member has. it also does that for the AP. but i'm pretty sure an actual vote has to take place first, so that won't help you know before the first time whether you'll be in the running. and doesn't help at all if you're playing vanilla or warlords.
one last bit of weirdness, the votes are cast at the start of the turn, but they're not added up until
after the turn is over. so say you're at war with shaka, and some vots comes up at the very beginning of turn X. you vote yes, shaka votes no, and then during turn X, you take over 5 of his cities. the population of those 5 cities are counted as
your yes votes, not as Shaka's no votes, even tho they belonged to him when you put your votes in the magic box.
you can end up with more votes than the "#1 population candidate" has, i suppose, in a case like that. it won't go back and re-do the vote with you as the new candidate, it just gives you more votes than he gets, shucks.
that can lead to funky things like "illegal" diplo wins. you don't have enough votes to win by yourself, so it's legal to put the resolution up for vote. you vote yes, everybody else votes no, but then during the turn you take over cities or grow enough that you can vote yourself winner. oops

. i accidentally won that way with the AP post-3.13, and i wasn't even at war. that's the power of sushi!