Mohamed Salah announced he is leaving Liverpool at the end of the season, despite his contract running until 2027.