Ericsson, the Swedish telecommunications giant, has agreed to plead guilty to charges in the United States for a “long-running” scheme that included paying bribes, prosecutors said Thursday.