I've encountered them in most hotels but I can't figure out what they are for. Some are even mounted on the walls. What are they?

I've encountered them in most hotels but I can't figure out what they are for. Some are even mounted on the walls. What are they?

These are for placing your luggage (presumably a suitcase) on. Easier to reach than if it's on the floor and you won't have to put it on the bed.
As mentioned, they are for luggage. They are also typically required to receive a certain star rating by the different companies that release star ratings. For example, the catalogue of criteria for Hotelstars has item 115 for "Adequate place or rack to put the luggage/suitcase", which is required for 3-star ratings and above. If this wasn't included in each room then the hotel might get a lower number of stars.
As far as I know, this is designed so that you can put your suitcase or bag on it while you take things in or out of it.
This makes it a lot more practical than on the floor, and compared to laying your suitcase or bag on a bed, it has the advantage of not risking dirtying the bed, and being able to keep it there even when you use the bed.
As a comment by Schmuddi says, one term for this item is "Luggage rack"
Dancrumb offered "luggage valet" or "suitcase valet".
I've found that "Luggage rack" gets good results on shopping websites if you want to confirm.