Basically, you take a major scale, and when you start and end on a different note than the root, you have a mode. This different note you started and ended on is the key of what you are playing.
For example, you could start on the third note of an A major, which is C#, and have a song in C# that has a dark tone. It takes a little bit of thinking
Here are two important things
http://www.theorylessons.com/modes.html -Scroll to the bottom, and there is a chart where the fancy names correspond to the Do Re Me's.
http://www.theorylessons.com/flats.html - Here, towards the bottom is a chart which tells you what sort of feels you will get with each one.
So now, when you decide you want a certain feel, like a dark metal one, you see what key the song is in, and find that note. You then decide which mode you will use based on these charts, and find which major scale has that note in the right position.
Suppose I have a song in "A flat" that I want a dark metal sound. I look it up, and locrian is the best mode for that. Locrian is the "ti" note, or the seventh. "A flat" is the "ti" note in the A major scale. So now, you use the A major scale, starting on "A flat"
Also, for it to be effective, you have to land on the roots fifths and other notes that make up the chord progression you are playing over. Otherwise, it will not work.