An Afghan branch of Islamic State has claimed responsibility for a suicide bombing in Pakistan that killed at least 54 people at a pro-Taliban party’s election rally, in one of the region’s worst attacks in recent years.