Press and hold the power button from about 10 to 30 seconds. Pulling the battery is a bad idea.

If the press and hold fails, there's a hardware issue.

The thing is, there are so many prior discussions about shut down failures that I think you meant you want a solution other than what's been discussed. It's an old issue caused by so many things from malware to folk updating drivers (please stop folk) to something else.

My test to see if it's a software issue is to boot Safe Mode and see if it shuts down fine there.

Be sure to know your power button settings too.
Bob