While there are different ways to sew an elastic waistband, the methods described here is the easiest as you don't have to worry about catching the elastic while sewing your waistband seam.
Step 1: Measure the Elastic
Use new, not recycled, elastic for your waistband. Purchase the correct type based on your pattern or the advice of your fabric store expert. Fit the elastic snug around your waist but not tight and add at least 1 inch for sewing overlap. Cut the elastic.
Step 2: Make the Casing
Leave about 4 inches of unfinished fabric at the top waistband area of your garment. Fold the unfinished fabric so that the casing will end up being between 1/4 and 1/2 inch wider than the elastic. Fold under the raw edge evenly, press and stitch a seam close to the raw edge to make a casing. You can also zig-zag or serge this raw edge. Leave an opening of about 2 inches to thread the elastic through.
Step 3: Thread the Elastic and Finish the Waistband
Pin a large safety pin on one end of the elastic and feed it through the casing, bunching up the fabric as you go. Hold the other end of the elastic so it does not slip inside. Once the elastic is inside the casing, lay its ends together on your sewing machine free arm with an overlap of 1/2 to 3/4 inch. Make sure the elastic is flat, not twisted, before stitching. Stitch the ends of the elastic together with a zig-zag or other overlapping stitch. Smooth out the waistband and hand- or machine-stitch the opening closed.