When we're looking at why Allah created, we can look at it from different perspectives, two of which we'll discuss here and one of them will be something that the philosophers have written.
Firstly when someone does an action, the aim of that action is either for themselves or for another. As an example, I may cook and the benefit of my action is myself (satisfying my hunger) and sometimes the aim of an action is someone else for example a father buys clothes for his child and here the one receiving the benefit is the child and not the father. Another example is a teacher who teaches not for themselves but for the student to learn and reach their aim of coming to study.
Sometimes when we look at why Allah created, we tend to ask if he didn't need he creation, why did he create? That is because we are looking at the subject from the lense of the first example. However if we look at it from the second lense that is Allah created because we need the existence and we would benefit and reach our aim of perfection. (Perfection would not be achieved if everything was determined for us hence we need free will to reach perfection which we'll discuss later since one of your questions pointed to this concept).
The philosophers have given their answer as well which is more in-depth.
They say that the creation is a manifestation of Allah's attributes. Allah is the creator hence he creates.
Allah is wajib ul wujud meaning the necessary existence and one of his attributes is creator therefore it cannot be that he does not create. To put this into an example,
If I were to ask why does rain rain down on us? It would not make sense because the nature of rain is to rain. If it doesn't rain, it's not rain.
In another more simpler example a teacher is not a teacher till they don't teach. (It's the nature of their occupation but if we apply the concept to Allah, it is Allah's attributes to create). It is important to note that Allah is NOT separate from Himself (requires another discussion). Hence if we look at it from this perspective, if Allah has not created, he wouldn't be the creator and that's not possible for him to not be the creator when the attribute of 'creator' is Himself (I hope this has made sense).
Above we made the point that we were created to reach perfection. Perfection would not be achieved if we did not have freewill. Hence this should answer your question that we have freewill and everything is not determined for us. As per the Shi'a faith, we do not believe in absolute determinism not do we believe in absolute free will rather something in the middle which in the hadith has been referred to as Amr bayn Al amrain (you can read more about this in this article
If you look at the subject from amr bayn Al amrain then yes we have freewill to decide our path and Allah has a hand in out affairs as well therefore duas, prayers, working for our success all have a role in our lives.
Now going onto your other question about shaytan, if Allah has given shaytan the freewill to chose his path and then as soon as shaytan does something wrong, Allah takes that freewill away or kills/destroys shaytan, Allah is going against his own justice. On one hand he's given freewill and then as soon as you do wrong, he takes it away which means he hasn't really given you anything and in this way, if we look at us as humans we'll never reach perfection because without freewill perfection is not possible. Yes sometimes our actions do cause certain blessings to be taken away but that is the nature of everything else. Every action has consequences but that does not mean that Allah has no hand in our affairs.