In general terms:
Vref --> Io: Having a known voltage reference Vref can be used to generate ANY current, if Vref somehow drives a known resistor (Io = Vref/R).
Vref --> Vo: Having a known voltage reference Vref can be used to generate ANY other voltage, if Vref can be somehow used to drive a known resistor (so the current is known: I = Vref/R) and then that current (or a mirror of it) goes through another resistor Ro, creating the new voltage: Vo = IRo.
The TL431 is simply the voltage reference and the feedback building block that can be applied in the scenarios mentioned above.

The behavior is simply that when REF > (Vref+ANODE), the NPN-BJT will try to draw more current by decreasing its effective resistance (because the op-amp will provide more Vbe), and when REF < (Vref+ANODE), the NPN-BJT will try to draw less current by increasing its internal resistance (because the op-amp will provide less Vbe).
If this effect is used as a negative feedback loop that affects the REF input, then the system will try to reach an equilibrium where REF = Vref+ANODE.
In the cited case of generating an output current ("constant current-sink"):

[Note that the drop at Rs is REF, and ANODE is GND (defines 0V)]
It works because if the drop at Rs (REF) is less than Vref (2.5V), then the internal BJT will increase its resistance, shunt less of the base current of the external BJT, so the external BJT gets more base current, which increases its emmitter current, which causes the drop on Rs to increase (so REF increases). Summary: {REF > Vref} makes REF decrease.
On the other hand if the drop at Rs (REF) is higher than Vref (2.5V), then the internal BJT will decrease its resistance, shunting more current, so the base of the external BJT gets less current, so its emitter current is less, so less voltage is dropped at Rs, decreasing RES. Summary: {REF < Vref} makes REF increase.
Therefore, at equilibrium REF = Vref (2.5V). Since the drop on Rs is known, and Rs is known, then the collector current is known, which is your output current. So can basically set the output current by properly selecting Rs (Io = 2.5V/Rs).