Assalamu Alaikum
Allah gives all of His commissioned creatures the absolute freedom to obey or disobey Him, because whether we choose believe in Him or deny him, agree or disagree, it will not affect Him in the slightest--it affects us. Allah could've annihilated Iblees at the moment he disobeyed Him, He could've even stopped his refusal, but He didn't.
Iblees's arrogance kept him from prostrating to Adam (pbuh). Then, through Allah's will, Shaytan was granted respite till the Day of Judgment to mislead us.
He (Iblees) said (as a justification to his refusal): "Seest Thou? this is the one whom Thou hast honoured above me! If Thou wilt but respite me to the Day of Judgment, I will surely bring his descendants under my sway - all but a few!" [17:62]
but if we have free will, wouldnt we disobey Allah sometimes?
We do disobey Allah. In fact, we probably do it everyday. Allah doesn't control what we do. Unlike the angels, we were given the capacity to carry knowledge and learn; therefore, we have the ability to process thoughts and know that there are consequences to our actions. Our conscience, knowledge, taqwah, and iman prevents us from from disobeying Allah. When we lose touch with those abstracts and we aren't able to control our nafs (self) and desires, we are open to shaytan's suggestions; but even shaytan doesn't have the ability to force us to disobey Allah which is why we are held accountable for all that we do.
There is a saying that goes something like
"Offer your companion a date, and if he rejects it, then give him a stone." (I heard this in a lecture I think and I wrote it down). The commentary that goes along with it was that Allah provides us guidance (the date) and when we reject it, the devils stray us into mischief and misguidance (the stone).
If anyone withdraws himself from remembrance of (Allah) Most Gracious, We appoint for him an evil one, to be an intimate companion to him.
Such (evil ones) really hinder them from the Path, but they think that they are being guided aright!
At length, when (such a one) comes to Us, he says (to his evil companion): "Would that between me and thee were the distance of East and West!" Ah! evil is the companion (indeed)!
When ye have done wrong, it will avail you nothing, that Day, that ye shall be partners in Punishment! [43:36-39]
so then what is the purpose of Shaitan again? Would we be just as disobeying without him?
I don't know if I can answer this question with proper knowledge, but I'll try.
Allah knows the outcome of everything He creates. When Allah subhanahu wa ta'ala created Adam (pbuh), He knew he was going to disobey Him (He knew, that doesn't mean He forced him to do so). Again, we all have freewill, and it is our actions that result in consequences. Our disobedience doesn't negate our freewill.
Adam (pbuh) could've continuously sinned even after being removed from Paradise, but his shame, resentment, and humility was manifest and Allah forgave him for his sincerity. Then,
after forgiving Adam, Allah sent him to earth.
It is wrong to blame Adam for our living on earth because this was not the result of his sin. Allah already decreed for Adam to be sent to earth even before creating him:
Behold, thy Lord said to the angels: "I will create a vicegerent on earth." They said: "Wilt Thou place therein one who will make mischief therein and shed blood?- whilst we do celebrate Thy praises and glorify Thy holy (name)?" He said: "I know what ye know not."
[2:30]
Adam's disobedience came from
forgetfulness. When we forget the commands of Allah, we tend to run with our ardent desires and disobey Him.
We had already, beforehand, taken the covenant of Adam, but he forgot: and We found on his part no firm resolve. [20:115]
It became knowledge to Adam that the shaytan is a deceiver (and even though he forgot Allah's commands, the desires of eating from the tree and living eternally were a preoccupation) and we are granted respite, guidance and the abode of paradise only through the worship to Allah.
We disobey Allah sometimes out of ignorance, arrogance, impatience and anger, whether shaytan is present or not. They are qualities that are weaknesses, characteristics of a human being, yet nonetheless controllable when seeking refuge from shaytan and seeking assistance and guidance from Allah subhanahu wa ta'ala.
Wa allahul 'aleem.
fi aman Allah
wa'alaikum asalaam