Its not truly a resignation, its a retirement.  He's just not running again.

A senator with integrity and patriotic spirit should do what he thinks is best for the country.  Knowing you aren't going to win the next election, you can speak out now to try to achieve the best end. Only in Trump world is speaking out for what you believe is right called "bad mouthing like a child."