Bakersfield Republican Kevin McCarthy, who won and lost the role of speaker of the U.S. House of Representatives in a tumultuous nine months this year, said on Wednesday that he will leave Congress, bringing an end to his 17-year congressional career.