Atticus needs the extension cord so he can take the lamp to the front of the jail and read while he’s sitting in the chair. It’s not just because he needs the light to see to read, but he wants more to be seen by the people in the town. He wants them to know that he is there guarding Tom Robinson, not with a gun, but with a book and his presence. The people respect Atticus, even though he’s taken on the job of defending Tom.
When the men come to take Tom from the jail, they are still respectful in their approach to Atticus, but they are determined to get Tom. It’s only when Scout shows up and starts to talk to them individually that they are shamed by her innocence and the questions she asks about their families. They leave the jail: they’re attempt at kidnapping and hanging Tom thwarted by the shame they feel from being confronted by the innocent questions of a child, not by any threat of violence.
Atticus sets himself up in front of the jail, a fantastical structure which some people say looks like a Victorian bathroom,reading by the light of the light bulb and extension flex he went off with earlier.
When the group of men assemble to threaten Atticus, Scout scans the men for a familiar face, and finally recognizes Mr. Cunningham.She addresses Mr. Cunningham and asks him about his entailment, but he doesn't answer. Scout keeps talking to Mr. Cunningham, and tells him that she goes to school with Walter, and to say hi to him for her.
Scout is remembering past advice from Atticus that it is polite to talk about what other people are interested in, until finally the silence starts to trouble her. Finally Cunningham squats down and tells Scout that he will give Walter her message, and then tells the other men that they're going to leave, which they do.