Know your rights. I'm going to drop a couple of helpful tips:
A stop (or an "investigative detention"
Terry V. Ohio) Requires Reason Suspicion. For a police officer to be able to stop you for an investigative detention (as in you're not allowed to leave until questioning is done) he requires "specific and articulable" facts that (a.) a crime is, has, or is about to occur and (b.) YOU had something to do with it. Absent reasonable suspicion, an officer cannot LEGALLY stop you or seize you (as delineated by the 4th Amendment).
Once an officer HAS stopped you (or seized) you, he cannot frisk you (pat you down for weapons) absent reasonable suspicion that you are "presently armed and dangerous". The justification for the frisk has to be INDEPENDENT OF THE STOP
Police officers requires Probable Cause to Arrest you.
Absent exigent circumstances, a police officer cannot search your home (WITHOUT YOUR CONSENT) without a warrant. Those exigent circumstances are (a.) The escape of a felon (b.) the destruction of evidence (c.) Harm to the police or public, absent any of those, they CANNOT search your home without a warrant or your consent. DON'T EVER give them your consent, if they don't have a warrant tell them to eat a dikk
Police officers require Probable Cause to search your car. But if they stop you and have a reasonable suspicion that you are currently armed and dangerous, they can search your front and passenger seat. If they have Probable Cause they can search your ENTIRE car
Know how Miranda works. Once you're being subjected to a "custodial interrogation", they will read you your Miranda Rights
Once you have been read your Miranda rights, EXPRESSLY (not unambiguously or unequivocally) ask for a Lawyer. Ask for a Lawyer (EXPRESSLY), say you won't be speaking until you've been obliged your 6th Amendment Right to Assistance of Counsel, and they cannot re-initiate questioning until (a.) you've gotten a lawyer (b.) YOU re-initiate questioning (don't be a fukking moron). After you've asked for a Lawyer, either (a.) Don't say another words (except maybe ask for water, food, bathroom, but THAT'S it) until you've received a lawyer (b.) Expressly invoke your 5th Amendment Right Against Self Incrimination (right to silence) and do not say another word (it can be waived) until your lawyer is present
MOST IMPORTANTLY: Cops do not have to tell you that you have a right NOT to consent to any searches or seizures under the 4th Amendment. They don't have to tell you, as long as you "voluntarily" give your consent they can do whatever they want to. Know your rights! It's not always going to save you, but it's a nice tool to have in your back pocket