If you want to get R you have to move 11 bits on the right so that G and B disappear. So
R=x>>11
but every shift of 1 bit is equivalent to a division by 2 so the expression above is equivalent to
R=X/(2^11)=x/2048
And so you get the R.
To get the G, according to the formula, you can first remove the R, which is the R you obtained previously but shift back of 11 bits (or multiplied by 2048). Now done this you have a number like:
111111 11111
You shift left of 5 bits (or divide for 32) and you get the result.
Note that in practice you can do this easier doing this:
B=(x and 0x1F)
G=((x>>5) and 0x3F)
R=((x>>11) and 0x1F)