how do you tell whether or not a compound is polar or non-polar?

To be polar you must have two conditions.

a. There must be a difference in the electronegativity (EN) of the elements making the bond AND
b. The molecule must not be symmetrical.
For example, CH4 is 2.1 for H and 2.5 for C for EN so that is a difference (although not all that much)
BUT, CH4 is symmetrical so the four individual dipoles are canceled.

CO2 is 2.5 for C and 3.5 for O so the EN is ok BUT CO2 is linear so the individual C=O dipoles cancel.

But NH3 is polar. There is the EN difference between the 3 NH bonds and it is a trigonal pyramidal and that is not symmetrical (as NH4^+ would be).