The examples differ markedly.
a. You can't play, but you want (to).
This comprises two main clauses joined by a coordinating conjunction (but). In such combinations, following "want", a "to infinitive" as an object is required, this "to infinitive" acts as an NP, but is often reduced to "to" (with a parallel implied infinitive (play))
Compare: "You can't play but you want a prize"
b. You can leave whenever you want (to).
(a) This comprises a main clause joined by a subordinating conjunction (whenever) to an adverbial clause. As the second clause is adverbial, the "to infinitive" is optional and is optionally indicated by "to".
(b) In the alternative, "whenever you want" can be used intransitively to mean "whenever that (= leaving/to leave) is your wish".
The adverbial clause can be further reduced to simply "whenever."