Often this can be solved by using the problem solver.
Click the Windows logo in the lower left corner, then 'Settings' (cogwheel).
Go to 'Update and protect'.
In the left-hand column, choose 'Activation'.
Choose 'Fix problem'.
Windows will now try to activate, press the 'Activate' button after a while.