Make sure you are not overloading the washer. Overloading your machine can keep the washer's spin mechanism from turning your clothes properly. If the washer overflows, it can cause the machine to not finish the cleaning cycle. Listen to the washer during the spin cycle. If it is making a drumming or thumping sound, it is probably overloaded.
Use different detergents. Some machines are built with liquid spouts that will distribute liquid washing machine soap evenly when the water is added. If you are using powdered detergent, put it directly in the washer before adding your clothes. This will help the washer evenly distribute the soap to the clothing.
Install a pre-filter. You could have a lot of metals in your water, which can cause stains and dingy clothing. Installing a pre-filter on the tube that supplies the washer with water is a great way to keep any metals or staining minerals from leaving clothing dirty.
Call a repairman. If nothing else works and the clothing is still coming out dirty or appears unwashed, it could be a problem with the internal mechanism, filters or the motor itself. In this case, it would be best to call a repairman or the manufacturer and let them know about the problem.