Atticus may have been a bit angry at Jem's initial refusal to leave the jail that night, but he wasn't angry afterward. The children's (Jem, Scout and Dill) arrival at the jail saved the day--and probably Tom Robinson's life. Atticus was alone at the jail when the lynch mob arrived, and it is unlikely that he would have been able to talk them out of removing Tom from behind bars. Atticus himself may have also been hurt. But the children's sudden appearance quelled the intentions of the men, and Jem's refusal to leave may have saved Atticus from injury. Although Scout and Dill seemed to be oblivious to what was happening around them, Jem sensed that something bad was about to happen. Atticus was proud of his son's decision to stay, and rubbing Jem's head was his way of showing the pride he had in his son.
In Chapter 15, Jem and the children find their father sitting outside of the Maycomb jailhouse surrounded by the Old Sarum bunch. After Scout runs out of their hiding spot, Jem and Dill follow her into the circle of men. Atticus realizes that his children are in danger and demands that Jem leave the scene. However, Jem refuses to leave his father alone surrounded by the mob. Jem demonstrates his loyalty and love for his father by refusing to go home. Fortunately, Walter Cunningham is able to view the situation from Atticus's perspective and tells the mob to leave. As Atticus and Jem are walking home in front of Scout and Dill, Scout is surprised that Atticus is not yelling at Jem for disobeying him. She also finds it strange when Atticus begins to massage Jem's head. Scout is too naive to understand that Atticus massaging Jem's head is a gesture of his affection. Atticus is proud of Jem for defending him and demonstrating his loyalty.