all the content inside the game belongs to riot, so you can't sell something you don't own.
I don't understand how you plan to sell the name, selling the account? Or you will rename your account so the summoner name becomes free to other user?
Selling the account it's obvious that you can't by ToS. Renaming your account to another name making the summoner name free to be used it's not against anything on the ToS.
If you accepted money to do that, hard to Riot find out at all, you just get tired of your summonername and paid 2600 RP to switch
.
However the word "illegal" it's not the right word, it's against game rules not "illegal".