Law enforcement agents must provide the Miranda warning to anyone they have in custody and plan to interrogate. Otherwise—if they interrogate the suspect without communicating the Miranda rights—the suspect's answers will generally be inadmissible in court. (For exceptions and limitations, see When Police Violate the Miranda Rule and Exceptions to the Miranda Rule.)
There's sometimes a question about whether the police have interrogated someone who provided incriminating information. If the suspect freely volunteered the statements and there was no interrogation, then the government is typically free to use those statements at trial. (See Does Miranda apply to spontaneous statements?) But if the officers interrogated the suspect—even without asking pointed questions—and there's been no warning, then the prosecution can't use the statements. It all comes down to the meaning of "interrogation."
Interrogation is express questioning about suspected criminal activity (for example, "Did you rob the store?") and its functional equivalent. To determine whether something other than express questioning constitutes interrogation, a court must evaluate the officers' words and actions, other than those that are part of the normal arrest or custody process. The judge considers whether the police should have known that anything they did or said was reasonably likely to draw out an incriminating response. (Some courts say express questioning doesn't constitute incrimination unless it has the tendency to evoke a damaging statement, but others say all express questioning equals interrogation.)
Ultimately, officers can speak to un-Mirandized suspects whom they have in custody as long as what they say isn't likely to elicit an incriminating response.
Example: Detectives Schrader and Gomez have been investigating Brandon and Pete for their involvement in a methamphetamine manufacturing scheme. The officers get a warrant for Pete's arrest and take him into custody, but they don't read him his Miranda rights. As they're driving him to the police station for booking, they begin to complain to each other that the arrest and its paperwork will probably foil their New Year's Eve plans. They then casually ask Pete what his New Year's plans had been, and Pete blurts out, "We're just amateurs, man—not professionals." Since neither the topic nor the tone of the conversation was reasonably likely to lead to self-incrimination, Pete's statement will probably be admissible in court. (United States v. Gelzer, 50 F.3d 1133 (2d Cir. 1995).)
Example: Police officers arrest Williams for robbery. During the trip by car to jail, he invokes his Miranda rights. The officers, knowing that Williams is a very religious former mental patient, comment to him that it would be a violation of Christian principles not to get the money back to the victims. Williams then implicates himself in the crime. Williams's statements will probably be inadmissible; the officers didn't directly question him about the crime, but they employed a tactic that predictably caused Williams to incriminate himself. (Brewer v. Williams, 430 U.S. 387 (1977).)