Miranda rights come from the 5th Amendment's Right to Remain Silent, along with a case by the United States Supreme Court, Miranda v. Arizona, where the court held a defendant had to be advised of basic rights, including the right to remain silent. Defendants are cautioned that anything they say can and will be used against them in a court of law, which tends to be very true. Often times, an officer will secretly tape record the conversations for later use in court, be it in the Interrogation room or squad car.
Because of Miranda v Arizona, failure of law enforcement to read the Miranda Rights usually results in any statements being suppressed as involuntary, as long as the individual was detained (not free to leave) and being interrogated. This distinction is routinely contested in court, with the prosecution arguing the defendant was not detained, in order to alleviate the officer's failure to read Miranda rights.
Interrogation is usually easy to show; as long as the officer is asking questions or seeking an admission, there is interrogation. However, demonstrating detention typically requires more of an analysis. If a person is not being detained -- for instance, simply standing on the sidewalk while an officer asks questions -- then there is no need for an officer to read the Miranda rights. However, if the individual is handcuffed, seated in the back of a squad car, and being questioned by three armed officers, then the court would generally find a detention, thereby requiring Miranda Rights to be read to the defendant.
As unlikely as it seems, many times an individual will blurt out a statement, before any question is posed. Such a statement is considered an excited utterance, and is exempt from the Miranda rights and 5th amendment law. Since the officer was not interrogating when the defendant made the statement, then it is admissible without a violation of the 5th amendment or Miranda rights.