The hangings, which took place in four prisons under conditions of increased security, coincided with the second day of a visit to Pakistan by Secretary of State John Kerry, who had come for talks on counterterrorism cooperation, economic aid and other issues.