Players can announce their retirement once they turn 32 (33 for goalkeepers). The older he is the higher the chance is that he will decide to retire. 

When a player announces to retire it will always happen during the season update and the player will always play the full season ahead before retiring. 

Once a player has announced his retirement he cannot be sold.