First it doesn’t really matter what’s between their legs unless you intend to date them. It’s easy enough to determine what most people identify as and thus what you ought to treat them as.
That said you can tell what virtually everyone has in there pants. 99.5% of people are cisgender. Of the people who are transgender it is usually not terribly hard to see most of the time both what their birth gender is and what gender they identify as which is why its pretty trivial to be polite. Although it is impossible to tell if someone has had surgery at least in the US you could bet on no and be right most of the time because of cost and inequality around here.
Meanwhile its impossible to tell the difference between coffee and milk just by looking at it! If you disagree I shall declare you an anti-milkist. It’s completely impossible you disagree with my assertion therefore you must be motivated by bigotry!