Tennis legend Roger Federer, the first men's player to win 20 grand slam titles, has announced his decision to retire from the sport after Laver Cup 2022.