If you think about it, it's clear what John actually wants is
Jim [write] a letter to the mayor
After "John wants...", we need to express it as a noun phrase, which means that [write] must be expressed either as a gerund (-ing) or a to-infinitive. It is actually possible to use either with want: we use the to-infinitive form for a single action, and a gerund form for a continuous (progressive) situation. The to-infinitive form is much more widely used.
John wants Jim to write to the mayor
John wants Jane running around afer him
It is also possible to use an implied to be (a silent copula?) to indicate a continuous (progressive) situation:
John wants Jane [to be] at his beck and call
That's looking at things from a semantic viewpoint. When you look at it from the grammar point of view, it seems that Jim, not the write-phrase, is the object. This makes no difference with a name, but if we substitute a pronoun, we have to use an object-pronoun him rather than a subject-pronoun he:
John wants him to write to the mayor
For this reason, when the Cambridge Dictionary complilers got to work on it, they itemised the most common noun clause forms using obj to represent the word in this position, because they have to describe it in a way that people can choose the correct pronoun form.
[ + obj + to infinitive ] Do you want me to take you to the airport?
[ + obj + past participle ] This package - do you want it sent today?
[ + obj + adj ] Do you want this pie hot?
[ + obj + -ing verb ] I don't want you
So, semantically Jim is the subject of the noun-phrase, which in turn is the object of the want-clause, but grammatically the word Jim is the object of the want-clause. In the same way that physicists have wave-particle duality, linguists have this.