Milk or sugar first to maximize temperature of a hot cup of tea?

The fact that sugar does not change the temperature can be true but this means that the time it takes to dissolve the sugar is important. The coffee will cool down exponentially all the time. Then, you drop the milk, which additionally reduces the temperature. But, mixing milk with coffee takes no time. So it will me immediate drop of temperature by some degree.

You can also drop both together and wait until sugar dissolves in the colder beverage. I think this is exactly the flipped order scenario. The milk, dropped into the hotter tea, causes more degrees to drop immediately because, say, when it is as cold as milk, the milk won't cool it down at all. I think that this is because you have an average energy between two masses, of tea and milk. Temperature is proportional to the energy, $$T_\textrm{mixed} = {MT_M + mT_m\over M+m}= {kmT_M+mT_m \over km+m}= {kT_M + T_m\over k+1}.$$

I think that sugar-first gives you higher temperature because in the first scenario you have shorter period of sugar melting, followed by some degrees lost due to milk. In second scenario, you first lose more degrees due to milk and then will have longer period of sugar melting, which again makes more degrees lost during the melting stage (compared to melting state in the scenario 1). So, since every of two phases causes more dramatic temperature loss in scenario №2, you will end up in colder liquid.

It is difficult to prove formally.

In the first scenario, you have t1 seconds to dissolve the sugar so that temperature drops from T10 to T11 and then additionally drops by T1m.

In the second, initial T20 is reduced by milk to T20-T2m which further exponentially reaches some end temperature during t2 seconds.

The temperature is decaying exponentially, proportionally to the difference between cup and room temperature, something like $T(T_0, t) = T_r + (T_0-T_r) e^{-at}$ where $T_r$ is the room temperature and t is current time since the beginning of experiment.

Let's have some amount of sugar m, which is solving at speed dm/dt = b*T(t), that is, we loose the sugar proportionally to the temperature. Integrating over time, we can figure out when all sugar is dissolved, $$\int_0^t kT(T_\textrm{fresh}, t)dt = \int_0^t T_r dt + \int_0^t T_r dt + \Delta T \int_0^t e^{-at}dt = T_rt + \Delta T {b\over a}(1-e^{-at}) =m.$$ We need to find out the $t$ such that the dissolved amount of sugar amounts to $m$. For me, $at + e^{bt} = c$ is quite difficult to solve for $t$. But, if you can, we know the time it takes to dissolve the sugar and can proceed and find the temperature we have at that point, $T_\textrm{sweet} = T(T_\textrm{fresh}, t)$ and finally $T_\text{sugar+milk}=(kT_\textrm{sweet}+T_m)/(k+1)$.

In the second scenario, we first find $T_\textrm{milked} = (kT_\textrm{fresh}+T_m)/(k+1)$, compute sweetening time $t_2$ given $T_r t_2 + (T_\textrm{milked}-T_r){b\over a}(1-e^{at_2}) =m $, taking temperature after $t_2$ seconds, $T_\text{milk + sugar} = T(T_\textrm{milked}, t_2)$

I can hardly contrast $T_\text{sugar+milk}$ with $T_\text{milk + sugar}$.

Edited because I had misread the question

If the goal is to keep the tea hot, you add the milk first. This will bring the temperature of the tea down by some amount $\Delta T$, and the cooler tea will now lose heat more slowly while you dissolve the sugar. I am assuming that since you cannot see the sugar in the milky tea, you will do what I do - you add it, and give a "fixed time stir" (about three turns).

If you add the milk after dissolving the sugar, the tea will have spent greater time at the higher temperature; in the process it will have lost more heat (almost all heat is lost by evaporation, which is very temperature dependent: hot air can contain far more moisture as described by the Clausius-Clapeyron equation, and evaporation is limited by how much moisture is carried away. )

Add the milk first. Don't blow on the tea.

If the processes are instantaneous, and you drink the tea at once after that, then it doesnt matter.

A more interesting question would be, when to put the milk in the tea. Now it does matter if you wait first and then add the milk and drink - or if you add it at once and then wait and drink. Do you see, why?

Also, in your formulation "you were asked to put milk or sugar in the tea". If you have to chose, then milk will usually have the higher thermal capacity.