When discussing an unwanted player, and the club's preference, there are two different elements, or facets, to this, and it can play out in a number of ways: Sometimes, it is the player who wishes to leave, - for pastures new, or, at least, greener, - while the club would prefer for them to stay (Newcastle and Isak come to mind), while, at other times, the club feels the player is surplus to requirement, or has no place, or role, in the manager's vision for the squad (often, as a result of other, presumably better, players, having been bought, thus displacing the unwanted player), while the player opts to stay put, as he fails to see better (or better paid) options elsewhere, and demand for his services may be limited.Usually unless it’s gross misconduct (like refusing to play or bringing the club into disrepute) a club would have to pay the wages. So if I was paid £100k a month and had 12 months left, they would have to pay me £1.2 million to leave early.
However there is usually a settlement that can be reached. Especially if the player is told he is no longer required and won’t be playing for them. Then a player will either find a solution, or sit happily in the stands collecting his wages.
As you say, if both parties are willing, a settlement can be reached.