It's best to get it out as soon as possible, before it dries. Use cold water - not hot - and put it right under the faucet to let the water run through the stain. You can put a small amount of detergent on it and gently rub the fabric while the water runs through it. Don't leave it to soak because the stain may just spread, it needs to wash away.
If it's dried blood, I would use the same method, but you may need to use warm water to get it to soften up. Get it wet and try to get the stain out as much as possible before putting it in the machine.
If the fabric is white, you can use hydrogen peroxide on it. Sometimes you can use a weak peroxide solution on colors, but be careful, test it first to make sure it won't bleach the color. Make sure you rinse it out completely, don't leave any peroxide in the fabric no matter what color it is.
I have heard that spitting on the stain will help it come out, because the enzymes in saliva help break down blood. I've also heard that hair spray will remove blood stains (pretreat with hair spray before washing). But I've never tried either of these methods. It can't hurt to try either one though.
Whatever you do, after you wash it in the machine, check to make sure the stain is gone before you put it in the dryer. Drying almost any kind of stain with heat will make it set permanently.