In general, you don't want to take criminal defense advice from television shows or movies about law enforcement. However, there is one standard suggestion made in most movies and shows that can also benefit you in the real world. It relates to those well-known Miranda rights people hear during an arrest.
You need to have extreme caution when speaking with law enforcement. As the popular phrase goes, anything you say can and will be held against you in a court of law. In other words, no matter how friendly or understanding a law enforcement officer seems, you do not want to talk with them about a potential crime unless you have an attorney present to help you. If you do not research or stand up for your own rights, law enforcement will be more than happy to ignore them.
When in doubt, ask to speak with an attorney
The officer asking to speak with you may not suggest that they believe have committed a crime, but perhaps instead are a witness to it. Regardless of what statements law enforcement officers make to you, you should never take them at face value.
Police can and will intentionally lie to you or obfuscate the truth in an attempt to gain evidence that they can use against you in court. You may answer questions innocently or claim to not know what law enforcement asks you about, only to later find out that your answers have helped them develop a case against you.
Even claiming that you don't know the answer or can't remember could potentially cause issues. Instead of taking any risks, your best option when discussing any criminal situation with law enforcement is always to ask for an attorney prior to sitting down with an officer.
If you don't know your rights, other people may not respect them
American citizens have many legal rights that people take for granted. For example, you have the right to avoid implicating yourself in criminal proceedings. You also have the right to legal representation for charges related to a potential crime. There are even rights that protect you from inhumane treatment and unreasonable searches of your person and your property.
Unfortunately, if you don't understand and invoke your rights, other people will gladly violate them. Law enforcement officers are particularly adept at convincing people to wave or ignore their rights in a criminal investigation.
In order to avoid getting yourself into a legally precarious position, you need to educate yourself about your rights and be willing to assert them when necessary. That includes asking for an attorney as soon as you suspect that law enforcement wants to question you about a potential crime.