I’ve had occasional points with my 2017 iMac hanging on shutdown, simply sitting there with the background picture and the dock up, however all apps closed and neither the menu bar nor any of the desktop icons displaying. And it stays that manner till I attain in and maintain the facility button till it does a hard-shutdown.
And now that I am principally migrated to my new M2 Mini, it is accomplished it persistently all week. In actual fact, this time, I shut it down a number of hours early, simply to see if it should finally full the power-down with out my having to resort to the facility button.
This appears slightly totally different from the signs described in different “hanging on shutdown” threads.