I’ve had occasional issues with my 2017 iMac hanging on shutdown, just sitting there with the background image and the dock up, but all apps closed and neither the menu bar nor any of the desktop icons showing. And it stays that way until I reach in and hold the power button until it does a hard-shutdown.
And now that I’m mostly migrated to my new M2 Mini, it’s done it consistently all week. In fact, this time, I shut it down several hours early, just to see if it will eventually complete the power-down without my having to resort to the power button.
This seems rather different from the symptoms described in other “hanging on shutdown” threads.