You are quite right about thyroid deficiency. There are other physical causes too - Addisons Disease,Late Stage Syphilis,Brain Tumors. Doctors tend not to test for these immediately because they are relatively rare compared to uncomplicated depression. There is little doubt that there are multiple causes of depression,on the social,interpersonal,psychological,and genetic levels.
As to why the drugs don't work for some that is complicated. Part of it is no doubt that they weren't deficient in the neurotransmitter being targeted and that the roots of their depression simply lay else where. Maybe they have been depressed for long enough for various physical changes in the brain to occur-the Amygdala tends to grow, the hippocampus tends to shrink. I've never understood what the current anti depressants could do about something like that. But above all you have to take into account the fact that the drugs simply aren't as powerful as the drug companies would have us believe.
Then there's expectation. A woman with five children who is depressed because she lives in overcrowded sub standard accommodation may well find her depression unaffected by Prozac. Anti-depressants don't compensate for society.Age comes into it. Older people tend to respond more poorly than younger ones. I could go on and on.
It's a complicated business.