An organization I'm quite fond of, Flex Your Rights, has put their video on youtube. The video is named Busted, and I highly recommend it.
Basically, the video offers suggestions about what to do when you're confronted by police, including traffic stops, when you're stopped on the street, or when they come to your front door.
I don't agree with everything in the video. In particular, I don't like the suggestion of rolling down your window just a crack. That's a good way of making a cop not like you, and most courts will consider that to be suspicious behavior. I also think you should try to be polite and even show a sense of humor with police, but the humor can be difficult unless you're an arrogant jerk like me, and you have the knowledge to back it up. :-)
Anyway, check the video out (it's somewhat long, maybe 45 minutes).