This is a color wheel.
Red, blue, and yellow are primary colors. Orange, green, and violet are secondary colors. In between these you have an infinite number of tertiary colors.
Complementary colors are the most basic of pairings. Pick any color on the wheel and look at the color that is directly opposite. For example, orange and blue are complements. While these direct complements work well in theory, with clothing it can often look tacky or too matchy-matchy, especially if the colors are very vibrant. Think red and green.
One way to avoid this is using a split complementary, which includes the two colors right next to the complement. For example, the split complementary of yellow is purple, violet, and blue. You can take yellow and match it with any, some, or all 3 of those colors and it will usually work.
Use uncommon tertiary colors and then either complementary or split complementary combinations. For example, you could make red and green work together by using a really deep burgundy with a nice shade of olive.
Keep in mind that not just color, but contrast and saturation, are important (see infographs below). You want to keep a visual balance; if you were wearing a vibrant orange sweater, you could wear a muted grey trouser to balance out the outfit. Black and white go with pretty much anything but don't overuse them (or buy more interesting styles).
Be aware that some colors combinations don't work well because of contextual stigmas. Black trousers with long sleeve white dress shirts are associated with waitstaff. Black trousers and short sleeve white dress shirts are associated with Mormons. Bright blue polo shirts and khakis are associated with CIA agents.
Helpful Online Tools
http://colorschemedesigner.com/ And its last version : http://colorschemedesigner.com/csd-3.5/ - When you arrive to the 3.5 version of the site, direct your attention to the drop-down menu at the top right. Hover your mouse over the Colorblind option, then select "Atypical Monochromatism." Go crazy with the other options.
http://www.colourlovers.com/fashion/palettes - This site is good for inspiration and nothing more. Due to the wide mix of colors, many of these palettes do not apply well to clothing. As such you should not take it too seriously. It's not advised to use more than 2 or 3 different colors in your outfit unless you want to look like you just came from Tumblr.
More Color Theory - Hue, Saturation, & Contrast
The guide on the left covers hue, value, saturation, contrast, and moods.
The guide on the right covers some basic color theory in relation to clothing.