Hotel upgrades have a great deal of discretion. While rooms may be pre-assigned to guests, the front desk agent can usually make a decision (within certain bounds set by the hotel — the best suites may require a manager’s approval).
There are many reasons they might upgrade you — your status, because you’ve been dis-serviced in some way, because you tipped them. Here are the techniques that work.