We've all been there at one time or another. You go to add a new load of laundry to the washing machine, only to discover that the load you washed a few days ago is still sitting in there...reeking of mold and mildew. Getting these odors out of clothes can be challenging. Sometimes simply running them through the wash again with detergent isn't enough to completely eliminate the mildew smell. Fortunately, there are some inexpensive tricks you can try that should get rid of the smell completely without damaging your clothes.
To begin, start by filling the washing machine just as you normally would. Once the water is done filling, add a cup of vinegar to the washer. Once the washer has agitated the vinegar around so that it is thoroughly mixed into the water, turn off the washing machine and allow the clothes to soak in the water. Generally, a good rule of thumb is that you should leave them soaking for at least and hour, although you can leave them longer if necessary. When the time is up, turn the washing machine back on and allow it to complete the cycle. 
Ideally, all traces of the vinegar and mildew smell will be removed during the rinse cycle. Check the clothing before putting it in the dryer, however, to make sure you don't need to run it through with plain laundry detergent one more time to get it as fresh as possible.
If you don't have vinegar on hand, you can do the same thing with baking soda or Borax. Just add a cup to the water, wait for it to dissolve, then allow it to soak long enough for the mildew to be destroyed.
Here's an interesting tip: for particularly tough odors that aren't affected by the baking soda or vinegar, try checking your local hunting store. They make laundry detergent for hunters that is designed to remove all traces of odor from clothing so that the animals can't smell them.  This can be an excellent tool to have when dealing with mildewed clothing.
If none of these ideas work, this video has several more suggestions that you can try: