Zipper packages actually have directions inside but sometimes I find other ways are easier or hearing directions from someone who has done it before can be helpful.
First off, here's a foot you would use to sew on your zipper. Don't put it on the machine just yet though.
1. Do not lay down your zipper yet. Machine bast the length of your zipper onto your garment with a 5.5" stitch or whatever the highest stitch is that your machine will allow. Keep your foot down on your garment, move to step 2.
2. Sew the rest of the garment opening (where the zipper will not be) at a 2.5" stitch.
3. Pin zipper face down with the middle of the zipper directly in your garment seam. See below:
4. Put your zipper foot on the right side (you can choose; right or left) and sew (regular 2.5" stitch) down the left side of the zipper as close as you can to the actual zipper part. Then switch the zipper foot to the left side and sew in the same way down the right side of the zipper.
5. Turn your garment inside-out and slowly rip out (with a seam ripper) the section of garment you have sewn together in step 1. You'll only rip out the length of the zipper... any further and you'll have a hole!