It's complicated. As many have pointed out, part of it is just the continuing evolution of merchandizing. You had general stores, then as communities became more urbanized specialized mom & pop stores, then "dime" stores , department stores and chains began eating into that, catalog sales for those living more remotely, then malls accommodating autos, then big box warehouse stores, and now online shopping eviscerating the malls and big boxes. Along the way, the better small mom and pop shops were able to survive by adapting: emphasizing customer service, quality products, specialized services, and frequently, moving from dying downtown locations to malls or strip malls. But too many of them -- and mall chains like Penney's, Macy's, etc. -- seemed to lose their ability to adapt to compete with online shopping. Instead of competing on the basis of customer service & quality of shopping experience as they had for generations, they began reducing staffing/stock/customer service in a futile attempt to compete on cost and convenience that they could never win.
That's the macro level explanation. Playing out beneath the service has been deplorable business practices by some of the bigger "winners": Safeway's continual redlining of neighborhoods and communities that don't meet their "image" needs; Walmart's extracti0ns of concessions from communities to open stores there and hiring of part-time workers to avoid providing benefits which tends to be a double hit on local tax payers, including their mom & pop competitors; Amazon's ruthless labor practices and use of their economic power.
And then you have the residue of the pandemic where employers found it was economically advantageous to continue having large swaths of the workforce continue working remotely, closing a lot of office buildings in downtowns and eliminating the foot traffic that small shops so depend upon.