I just got out of a traffic ticket. I have probably been pulled over 30 times and I've only gotten 5 tickets. The key is to show them respect because most cops deeply crave respect. Why else would they take a low paying, dangerous job?
1) It helps to have a decent car, one with no dents, that is clean on the interior, that doesn't have any offensive bumper stickers. Hopefully, you are dressed well and don't have any outstanding warrants. You can't convey respect to the cop if he doesn't respect you in the first place. One flip side to this is, if your car is really a piece of junk they may have pity on you and assume you can't afford the ticket.
2) If it's night, cut on your interior lights. This shows you have nothing to hide, and puts them at ease. It also shows respect in that you are considerate of their situation, walking up to a stranger that could be armed or have warrants.
3) Roll down you window and put your hands in plain sight. Often I put one hand outside the window and the other on the steering wheel. This also puts them at ease. Also, by showing this deference they may assume that you know a cop.
4) Address them as "officer." Don't call them dude or bro.
5) When they ask you "Do you know why I pulled you over?" Go ahead and confess. Tell them the truth... "I was speeding. You caught me." "I am running late." "I need to go to the bathroom." "I wasn't paying attention." Cops hear a lot of bullshit, and most of them are good at sniffing it out. If you give them lip or attitude they will become defensive and give you a ticket or worse, but if you are respectful the only way they have to further fill their need for respect is to be magnanimous and let you off.
As the situation unfolds you may find other ways to show respect or feed their egos. Another idea is to be sure to pull over far enough so they don't have to stand in the road. A lot of girls, say they cry to get out of tickets. I doubt that would work for men. I haven't tried it. Some times you are going to get a ticket. Usually when I get tickets, it's in a trap, and the cops barely speak to me. I assume they are trying to fill a quota.
I learned some of these techniques intuitively, and from listening to police. However, later I found the general idea is well articulated in the book "How to win friends and influence people."
Do you know any ways to get out of a ticket?
There is one more way, don't speed : )