There are any number of factors that can help cause a person to confess to a crime that they did not commit.
Perhaps the most intuitively obvious such factor is actual physical coercion. Imagine that you know exactly what the police want you to confess to having done and imagine the police are causing you physical pain. It is at least possible that you will confess simply so that they will stop hurting you.
Luckily, it is not believed that actual torture like this is common in the US. However, mental and emotional pain can also cause a person to confess. The police might interrogate people in ways that so stressful that people will want to confess simply to get rid of the unwanted stress.
The police might also essentially trick people into confessing. The police might lie to a person and tell them that they (the police) have overwhelming evidence of the person’s guilt. They might say that it is in the person’s best interests to confess because it will get them a lighter sentence. These sorts of tactics can cause some people to think that they had better confess while they still can.
In general, such tactics work best on people who are mentally ill, or who are less mentally competent, those who are young and/or of low socioeconomic status, and those who are naïve. A well-educated, person with a good sense of their own importance is more likely to hold out against such tactics.
Yeah that's one side effect of torture.