If there are no lone pairs on the central atom then the electron-pair geometry and the molecular geometry are the same. For example, for CH
4 there are 4 bonds to the carbon atom and no extra lone pairs are left over. The electron-pair geometry is tetrahedral and the molecular geometry is tetrahedral. For NH
3, the central nitrogen atom contains three bonds and one lone pair. The electron pair geometry is tetrahedral because there are 4 distinct "sets" of electrons on the molecule as before. However, the lone pair doesn't show up in the molecular geometry directly...what it does is it pushes the other three bonds away from itself forming a "pyramid" with the three bonds that are left on the atom near the bottom and the central atom on top of the pyramid. So they give this molecular geometry the name trigonal pyramidal.
To solve these problems, first write the correct Lewis structure. Next count the number of bonds and lone pairs on the central atom. This gives the electron pair geometry. Next, if you have lone pairs count them. Depending on how many lone pairs you have the name for the molecular geometry will change. Knowing which name to give is just a matter of memorization