Cops are people too. Their job is to go from one call to another to deal with some douchebag's actions in one way or another. Most everyone hates them, yet expects them to put their life on the line for them, recover their stolen property, etc. When the police need your help to put away a bad guy, most people do not help them, then complain about how the police do nothing to protect them against the bad guys. When was the last time you heard of a cop being called to attend a bar b q? They deal with pieces of shit ALL day long, and see the absolute worst in people. Suicides, child abuse, rape, etc. It makes you jaded, and knowing that the legal system protects the guilty makes it all the more demoralizing.
Bottom line, if you treat them with respect and act like you are trying to help, they will treat you well. If you act like a dick, you will be treated badly. If you are doing something illegal and they catch you, THAT is on you. Man up.
I've had a couple dozen run ins with the police and almost every time, they let me go because I was respectful, and treated them like a fellow human doing a difficult job. Try it some time and see how far it gets you.