Let's begin by thinking of a polar bond as a vector pointed from the positively charged atom to the negatively charged atom. The size of this vector is proportional to the difference in electronegativity of the two atoms.
If the two atoms are identical, the magnitude of the vector is zero, hence we have a nonpolar bond.
Now let's consider molecules with three atoms. We can establish from the Lewis dot structures and VSEPR that CO2 is a linear molecule. Each of the CO bonds will have a vector arrow pointing from the carbon to the oxygen. The two vectors should be identical and pointed in exactly opposite directions. The sum of these two vectors must be zero because the vectors must cancel one another out. Even though the C-O bonds must be polar, the CO2 molecule is nonpolar.
HCN, hydrogen cyanide, is linear. Since C is more electronegative than H we expect a vector pointing from H to C. In addition, N is more electronegative than C (and H) so we would expect a bond vector pointing from C to N. The H-C and C-N vectors add to give a total vector pointing from the H to the N. HCN is polar with the hydrogen end somewhat positive and the nitrogen end somewhat negative.
In contrast, let's examine the case of SO2. We know from Lewis dots and from VSEPR that this molecule is bent. Its overall geometry would be considered to be trigonal planar if we considered the lone pair electrons on S. Lone pair electrons are not considered when we examine polarity since they have already been taken into account in the electronegativity.
We would predict that there should be polarity vectors pointing from the sulfur to the two oxygens. Since the molecule is bent the vectors will not cancel out. Instead they should add to give a combined vector that bisects the O-S-O angle and points from the S to a point inbetween the two oxygens.
If we add a third oxygen to SO2, we create the trigonal planar molecule, SO3. In this case the three S-O vectors will exactly cancel so that the molecule is nonpolar. This point is illustrated below along with a simple vector illustration to show how we can picture the vector additions.
Moving to a tetrahedral molecule, carbon tetrachloride, we recognize that the four C-Cl bonds will be polar and this will be represented by vectors pointing from the C to the Cl. It is not exactly obvious without a little practice that these four vectors will cancel out. If we pick one of the vectors and think of it falling on an imaginary z axis, the other three vectors point down below the xy plane. The vectors in the x and y directions all cancel (just like in the case of SO3 above), leaving a vector pointing in the -z direction that is exactly equal to the C-Cl vector pointing in the +z direction. These points are illustrated below:
Chloroform is a simple molecule whose polarity can be easily deduced. In this molecule we will have four bonds. The bond vector for the C-H bond will point from H to C. The bond polarities for the three C-Cl bonds will point toward the Cl ends. As in the case of carbon tetrachloride, let's select a z direction, and in this case we'll put the unique C-H bond along the z axis. The H-C vector points in the -z direction. Also, the sums of the three C-Cl vectors also points in this direction. These vectors add to give a large vector in the -z direction.
More complex molecules
Polarity analysis for molecules of trigonal bipyramidal and octahedral geometry is similar. When molecules begin to get very large it is necessary to examine the polarities of either specific groups or combinations of groups. We can make some simplifying assumptions, for example, molecules or portions of molecules consisting of only C and H will be mostly nonpolar since the bond polarities are quite small and the vectors generally cancel.