Shares of Norfolk Southern Corp. rose after hours on Thursday, after the railroad operator reported second-quarter results that beat expectations and tightened up a key efficiency metric as the company emerges from a fight with an activist shareholder and deals with the fallout from last year’s derailment in Ohio.