Disclaimer: Remember this is only about how magic works in the majority of Arabian Nights tales. Being orally told for a long time, some did deviate from this. Also you can have a Middle Eastern setting which does necessarily follow this.
The traditional term for a sorcerer in Arabic is “kahin,” and they are strongly associated with djinn. In Middle Eastern folklore magic is strongly tied to invoking spirits. A sorcerer may command and bind djinn, ordering them to perform tasks for him. If a sorcerer claims his powers are purely innate, he is usually thought to be lying. For example, if he claims he is flying, he is usually just being lifted into the air by invisible djinn. If he claims he can tell the future, it is because djinn have flown to the gates of heaven, listened to the conversations of the angels, and relayed them to him. You get the idea. Magical items are often associated with djinn as well, based on the idea that a sorcerer could bind them to physical objects. In this case, you did not need to be a sorcerer yourself to command a djinni, you simply needed to own one of these items. Sometimes you also needed to know an incantation that would summon the djinni and let you control him, but most of the time simply holding the object was enough.
There were other cases when people could use djinn to further their own ends. Very holy men, like King Solomon, were thought to be able to command them through divine authority. Djinn who fell in love with people might sometimes offer to do them favors. And some sorcerers claimed djinn aided them willingly, that they had been born being able to see the invisible creatures, and that they were drawn to one another.
Keep in mind; this is just a rule of thumb. Most belief in magic in the Middle East might have involved the invoking of spirits, but there was room for other beliefs. Alchemy, for example, flourished in the region (the word itself is Arabic), and its practitioners were sometimes regarded as semi-supernatural.