Droids are treated like animals at best, and there seems to be a total indifference to droids and their activities. Based on this, do they even bother studying their artificial minds?
I would think studying the artificial mind would help gain some insight into how to build better droids. In some areas, such research may prove beneficial such as medical droids. The medical droids seem to function as well as, perhaps even surpassing the abilities of a humanoid doctor. Case in point, the droid that healed Luke after the wampa attack, or the one that gave Luke an artificial hand. Or the ones that saved Vader's life and made him functional again. If developing droids to be mere machines, I'm not sure anyone would invest so much time to have these droids have personalities.
Addressing your first point, some droids aren't treated very well, but for the most part, there seems to be genuine concern for their well being. Like when Poe was reunited with BP88, Chewie trying to reassemble C3PO on Bespin, when Luke thought R2 had drowned on Dagobah, etc.
If you want to truly understand driods, play KotOR series and see how HK47 behaves and then SWTOR and then read some SW books.
HK47 is only a start. There are quite many references related to the subject you've stated through out SW universe overall, some going as highly complex as Droids possibly using the Force (there is a Star Wars The Old Republic mission related to this). So there are many occasions when their AI is studied, improved upon for different purposes. Since I found the Droids using the Force SWTOR mission very interesting, I'll try to remember how is it called exactly and update this.
Droid intelligence levels in SW are defined in various degrees. Droids were typically programmed with certain restraints in their artificial intelligence, which limited their overall AI capabilities. For example, most droids possessed deeply embedded life preservation programming not to allow them to attack 'meatbags' (sentient beings). Of course, assassin droids were the exception.