Hearsay is defined as an "out of court statement, offered in evidence to prove the truth of the matter asserted."

There are a number of exceptions -- i.e. circumstances in which a person would be expected/motivated to tell the truth, or would at least be unlikely to lie, in which an out of court statement is admissible. By way of an example, a statement made to a physician by one seeking medical treatment, which is relevant to the medical treatment, is admissible. If you tell your doctor "I have a stabbing pain in the lower abdomen" you are probably telling the truth since a lie might lead to an unnecessary appendectomy.

Hearsay exceptions are divided into 2 categories - in one case, the "declarant" is unavailable at trial - in the second category, the availability of the declarant is irrelevant.

Under the "declarant unavailable" category, you have:
-- former testimony - testimony given at another trial/hearing/proceeding by a witness who is not presently available, if the party against whom this testimony is offered had an opportunity to cross-examine in the earlier action.
-- Statement under belief of impending death concerning the circumstances surrounding his/her death - this one is the Hollywood trope of the murder victim gasping out a name as he dies.
-- Statement of personal or family history - information about your own birth date, marriage, ancestry etc. is normally admissible - no one can remember when they were born but we readily let witnesses testify to their age or date of birth.
-- Statement against Interest. This is the one that you are interested in. A statement made by a declarant which, at the time it was made, was so far contrary to the interests of the declarant that a reasonable person would not have made the statement unless it was true. However, in a criminal case, a statement offered tending to expose the declarant to criminal liability and tending to exculpate the defendant is not admissible unless there is corroborating evidence.(The reason for this is that it is too easy for a criminal defendant to testify "I did not do it - but Billy told me he did it" -- such testimony would only be admissible if there were some evidence supporting the assertion that Billy did it.

There was a relatively famous US Supreme Court case (Chambers v. Mississippi, 410 US 284 (1973)) which involved this idea. There was an altercation at a bar which spilled over into the surrounding street. A police officer was shot. The shots came from down an alley - none of the other officers present could actually see down the alley. The wounded officer turned, fired back down the alley, then collapsed. Fellow officers observed a fallen person lying in the alley but, in the confusion of the melee that was going on, did not secure the scene. The wounded officer died without regaining consciousness. (by the way, in this case, all principal participants were African Americans, including the police officer).

The wounded man in the alley was Leon Chambers. Friends found him and took him to a hospital, where he recovered from his wounds (and was charged with murder in the death of the police officer). Chambers insisted that he had been in the alley - but another man in the alley had fired the fatal shot at the police officer. The officer fired back, missed the shooter but hit Leon Chambers.

The day after the shooting, another local man named Gable McDonald fled from Mississippi to Louisiana. In Louisiana, the told at least 3 different people that he was the shooter. He stated that he had thrown the gun into a river. McDonald actually gave a sworn confession in Louisiana that he had been the shooter. But , when he learned that he might face capital punishment in Mississippi, he recanted the confession.

Chambers defense team wanted to introduce the recanted confession of Gable McDonald. This would have involved putting McDonald on the stand, having him deny it, then calling witnesses to contradict McDonald's testimony by saying they heard his "admission against interest". However, Mississippi had a rule that, when you called a witness, you "vouched" for his credibility - you cannot call witnesses to contract your own witness' testimony. The prosecution by the way, was NOT going to call Gable McDonald and was NOT going to introduce any evidence that he had confessed.

Chambers was convicted and sentenced to life in prison by a jury that did not hear about McDonald's testimony. On appeal, the US Supreme Court reversed and ordered a new trial. The prosecutor dropped the charges.