A molecule with polar bonds has several pulls at once. The directions its bonds point in decide whether those pulls add up or cancel out.
Think of each polar bond as a pull in one direction, towards its δ− end. When all the pulls in a molecule add up to an overall pull one way, the molecule has a negative end and a positive end. It is a polar molecule. When the pulls cancel out, so the molecule has no overall negative end and positive end, it is a non-polar molecule.
Carbon dioxide and water
Carbon dioxide, as you have seen, is straight, with its two oxygens 180° apart. Each C=O bond is polar, and each oxygen pulls just as hard as the other, in exactly the opposite direction. The two pulls cancel, so carbon dioxide is non-polar.
Water is bent, with its bonds 104.5° apart. Both O–H bonds pull towards the oxygen, so both pulls lean the same way and add up. The oxygen side of the molecule is δ− and the hydrogen side is δ+. Water is a polar molecule.
Ammonia works the same way as water: its pyramid has the nitrogen on top and three δ+ hydrogens below, so ammonia is polar. Methane, hexane and every other hydrocarbon have only carbon-carbon and C–H bonds, so hydrocarbons are non-polar, or very nearly so.
Same bonds, different result
Carbon tetrachloride, CCl₄, has four polar C–Cl bonds pointing to the corners of a tetrahedron. All four pull equally hard in evenly spread directions, so they cancel and the molecule is non-polar. Chloroform, CHCl₃, swaps one chlorine for a hydrogen. Its three C–Cl pulls all lean away from the hydrogen and add up, so the chlorine side is δ− and chloroform is polar.
Drag the model to turn it. Pinch to zoom, or use the buttons.
Drag the model to turn it. Pinch to zoom, or use the buttons.