Detroit and the surrounding area had many blue collar workers that essentially did menial labor. They got big $$ as the unions were strong and what the fuck, they spewed forth cars in the millions.
In came the robots, initially to do the most hazardous tasks like welding, cleaning and painting. This was the shoehorn to get people on the line to accept them. Now they're more commonplace. They work lights-out operations, don't take breaks, don't call in sick, don't drink on the job. Although maintenance on a robot can range from $150k to $300k a year, they still are cheaper than people.
Little by little the fab part and assembly detail work went offshore. I believe that most of the big stampings are still kept here.
Another thing that failed Detroit was that most of the factories were old and antiquated. It was easier to start a factory in China or Mexico with all the latest technology. The way things are built also changed using the latest factory philosophies that most of the world now embrace.