In To Kill a Mockingbird, for what reason do the men come to the jail?
A mob of drunken men, under the leadership of Walter Cunningham Sr, has descended upon the jailhouse with the express purpose of lynching Tom Robinson, who's being held there in custody. At that time in the South, lynchings of African Americans were depressingly common. In particular, they were often carried out against African American males accused of raping white women, as in the case of Mayella Ewell. In fact, even if a black man so much as looked at a white woman or spoke out of turn to her in any way, he could find himself being subjected to summary execution by a baying lynch mob.
Most white southerners were deeply afraid of race mixing. To that end, the races were to be kept strictly separate, and African Americans needed to know their place and remain in a position of subordination to whites. This explains the serious punishments, both judicial and extra-judicial, that were meted out to those suspected of any kind of sexual involvement with white women, whether or not it was consensual. Either way, this was a crude method of social control which had nothing to do with justice.
Tom is wholly innocent of all the charges made against him, but it doesn't matter to the restless mob outside the jailhouse. He's an African American male accused of raping a white woman, and far as they're concerned, that means he's automatically guilty. As it comes out later on in his trial, Tom's also guilty of what's widely regarded as another "crime"—feeling sorry for a white woman. It says a lot about racial attitudes at that time that a simple gesture of decency and humanity is perceived as a threat because it momentarily places a member of the dominant race in a subordinate position to a supposed inferior.
The men come to the jail one evening because Tom Robinson has been moved there. He was kept in a neighboring jail, and is moved to the Maycomb jail to await the start of his trial. Heck Tate, the sheriff, and other men are concerned about Tom being in the Maycomb jail. They come to the Finch house to express their concern to Atticus--that someone might try to get to Tom and kill him (lynch him) before the trial. This is why Atticus stations himself outside the jail that night.
The group of drunk farmers, including Mr. Cunningham, show up in order to get to Tom and, presumably, kill him before the trial. In this time, people of color were looked down upon, and some white people, like those in the mob, may wish to harm Tom just because he's black or harm him because they assume he's guilty, because he's black.
Atticus explains the next day to Scout that, even though Mr. Walter Cunningham was part of the mob, they weren't to stop being friends with him or his son. Atticus believes that the mob was just made up of men, and all men have their blind spots. With enough alcohol and peer pressure, even good men can be persuaded to join mobs and do things they wouldn't normally do under their own will.