Requirements:
Hostnames in Windows can contain all alphabetic characters (A-Z), numeric characters (0-9), a hyphen (-), and the period (.). Period characters are allowed only when used to delimit the components of domain style names.
It cannot consist of only numbers.
It must not begin or end with a hyphen or period.
If the server is a member of an Active Directory Domain, it cannot have a name that only contains numerals, this is a DNS restriction.
The Hostname must be 63 characters or fewer. If NetBIOS compatibility is necessary, 1-15 characters. It also cannot be any of the reserved words listed here: https://learn.microsoft.com/en-us/troubleshoot/windows-server/active-directory/naming-conventions-for-computer-domain-site-ou#table-of-reserved-words
Recommendations:
Use a hostname unique to the server and easily remembered, if possible, it should fit the purpose of the server.
Use ASCII (7) characters, whilst unicode characters are technically supported, joining to a domain will require ASCII, and a lot of applications/switches do not support anything beyond ASCII (7) for this purpose.
Changing the Hostname in Windows:
Search for and open "Server Manager". It will often be open when you log in.

Under Local Server, click on the highlighted ‘computer name’, in this case, it would be example.

Select change. If the Server is a Domain controller, you will get a warning.

Rename the computer as you’d like, then press ok, it will inform you that you must restart your computer to apply these changes.

The new name should show under Server Manager —> Local Server after a restart.

Congratulations! You have changed the Hostname on Windows!