1. t_id set to zero
2. is t_id less then 65536? (Yes, since it was set to 0 previously)
3. increment t_id, now equal to 1
4. set query equal to t_id right shift 1 by 8 bits, i.e. zero
What is the point of this whole thing? Or where am I going wrong?
The code needs more context to be understood properly but I can suggest that it looks like it's supposed to be in a function that is expected to be called many times.
t_id is static so it only gets initialised the first time the function is called and it retains it's value between function calls. What this means is that the variable is not destroyed when the function ends, it's only destroyed when the entire program terminates.
The designer wants the value of t_id to increment every time the function is called. It is quite feasible that the function may be called in excess of 65535 times. If this happens, the designer wants the value to be reset back to zero.
This effectively restricts t_id to numbers that range from 0 to 65535, or in other words, all the numbers that can fit into a two byte variable (which is alluded by the type 'uint16'. Taking that into consideration, you can think of the number held by t_id as a number with bits spread out across 16 bits, or two sets of 8 bits. It looks like the designer is only interested in the bits from the high byte (bits 9 to 16) and the quickest way to find out what those bits are is to chop the bits in the low byte off (bits 1 to 8), ie to shift the entire number right by 8 bits. This will only produce non-zero results once t_id increments to 256 or greater.
Sorry, I can't offer you any more explanation than that without seeing more code. I hope it turns a light bulb on somewhere.