Warning: Major spoilers for IT Chapter Two ahead.
Years after the Losers Club first fought Pennywise (Bill Skarsgård) in the sewer, they have regrouped in IT Chapter Two to finish the dancing clown once and for all. However, while most of the Losers have returned to Derry for the task, one character does not: Stanley Uris (Andy Bean) makes a choice not to return to Derry after Mike (Isaiah Mustafa) begs him to help with the fight. We don't find out why until Stanley's letter at the end of IT explains his reasoning.
Though the members of the Losers Club, as adults, can't remember exactly why they promised to return to Derry, they feel nauseous and afraid hearing Mike's voice asking them to come back. When Stanley gets the call from Mike, however, he immediately goes upstairs to the bathroom and dies by suicide.
In a letter Stanley's widow Patricia Uris sent to the group after the Losers defeat Pennywise as adults, Stanley explains that he knew he wouldn't be brave enough to face "It" — so he made a choice that would confirm he never had to.
In the film, the Losers don't remember It, Pennywise (the amorphous monster's favorite form) or the specific horror of their childhood years. The closer they get to Derry, the easier the horrible memories come back. Stanley, however, seems to remember much more than the Losers initially did when Mike called.
We don't know exactly why Stanley remembers the horror of It. Mike says that the closer you get to Derry, the more you remember, but we don't really know if Stanley lived any closer to the town in Maine than the other Losers did. (In Stephen King's novel, Stanley lives in Atlanta, which is not exactly close to Maine, and is further than New York, where Beverly lives.)
What we do know is that a key personality trait of Stanley was how afraid he was of everything. When the rest of the Losers decided to fight, Stanley was quick to retreat, and needed a lot of coaxing to go along with their plan. Since It's real power is making people afraid, Stanley's heightened fear may have made it easier for him to remember more than his braver peers.
His tendency towards fear is what Stanley says is his reason for his decision to remove himself from the group, instead of returning to Derry. Stanley believes that the Losers needed to be a strong united force, if they had any hope of taking down It. Though they caused It to retreat 27 years earlier, they didn't kill the monster. Stanley is sure he would retreat if he was faced with fighting It, and that would be the group's downfall — so, he decided to take himself "off the board."
Stanley's death by suicide was used against the Losers by It, who taunted them with cruel messages about their friend's death and even had a child version of Stanley appear to the group as a spider creature with a human head. (Stanley, in flashbacks, revealed how he was afraid of spiders getting in his hair while spending time in the gang's underground clubhouse.)
Stanley is correct that bravery was needed in order to take down It. In order to defeat Pennywise, the remaining members of the group confront the clown and mock him, making him appear small and weak. However, that doesn't really explain why Stanley needed to die in order for the rest of the group to defeat It, as opposed to just not show up. It also doesn't reveal how Stanley knew his only options were to stand up to It with his friends, or die alone. As far as has been established by the film, It would not have found Stanley in his home outside of Derry: It simply doesn't have power that far away from the sewer.
Stanley may have thought he was doing the right thing by his friends, but how he knew that is one of IT's most puzzling mysteries.
If you are thinking about suicide, please call the National Suicide Prevention Lifeline at 1-800-273-TALK (8255) or the Suicide Crisis Line at 1-800-784-2433.