Jem, in shimmying under the fence to get away from the Radley place after they saw the shadow on the porch, gets his pants caught. He ends up just leaving them. So later on that night, he decides to go back and get them. Scout is terrified, worried that he'll get his "head shot off" by Mr. Radley, or Boo, for their earlier trespassing. Jem, however, knows that if Mr. Radley discovers the pants he'll tell Atticus, and Atticus will give him a beating. Jem says, "Atticus ain't ever whipped me since I can remember. I wanta keep it that way". So, to avoid shaming himself in front of Atticus for doing something Jem says "we shouldn'a done", Jem goes to fetch them.
The surprise that he finds is that his pants are uncaught, and "folded across the fence", AND the tear had been stitched up. That means that someone saw them retreating, went out to investigate, and instead of going to Atticus with what they had done, fixed and put Jem's pants there for him to retrieve. An ally? Jem feels a combination of gratitude and alarm that someone would know him so well to know that he would come back for them.
Scout fears for her brother because all she understands is that the Radley's are 'different and mysterious' which she interprets as something to fear. Scout does not understand why her brother would want to return to such a 'scary' place. This is a crucial point in the novel because when Jem sees that his pants have been mended he realizes that Boo just wants to be friends. In that moment Jem knew he no longer had to be fearful of Boo, or potential consequences. Scout's fear was a combination of her lack of understanding Boo Radley (despite Atticus' lessons of compassion) and her brother's new sense of awareness. Jem realizes the mended pants ae well as the gifts left in the tree were attempts at friendship.In that moment Jem gained the wisdom of compassion,as well as, the realization of how important it is to think for ones' self.