It doesn't always work - I have some stains in a brown cotton top I just can't get rid of. I gave up last week and threw it out.
But what I normally do is dab the affected area with fairy liquid then throw it into the wash. The wash cycle I put it on is dependent on the fabric garment so e.g. if it were my linen suit it would go in alone on a quick wash, my cotton top went in on a 40C normal wash. Something silk I'd prob put on a gentle/handwash all with normal detergent.