Speaking for myself, I really don't have a clue how to pick compatible colors. I've looked but haven't found any books to help me learn about this.
Color Schemer is an application that helps you pick good palette. It even has a mode where, if you give it a picture, it will determine a suitable palette from that picture.
visibone.com sells useful reference books, which includes color palette references.
Part of the visibone guides are "web-safe" palette guides. This concept arose in the early web, and isn't terribly important today. In the early days of the web, the typical computer might have 8-bit or 16-bit graphics, which greatly limited the number of colors that could be displayed. Other technical details limited the range of colors even more. So if you wanted to display colors outside the typical range, your user might see flashing on the screen, or the computer might interpolate your color to some other color.
Today the typical computer has lots of video memory, and can display millions or billions of colors. In my opinion it's now safe to ignore the "web-safe" palette.