Islamic State has claimed responsibility for a terror attack at a pro-Taliban political rally in Pakistan that killed 54.