user-1: I was doing this exercise on lichess, but I don't see why the best move for white is to sacrifice their queen in exchange for a knight (after Nh3+):
 [title "lichess puzzle 61517"]
 [fen "4r1k1/p1b2pp1/1pp2r2/3p2np/1P1P2q1/P3P1P1/2R1NPQP/2R2NK1 b - - 1 28"]


user15078: Because white will lose the queen anyway after Nh3+, since otherwise Kh1 is answered with Rxf2 trapping and winning the queen. Just try to work out the tactics by yourself. 
As to why white doesn't give up the queen for the rook instead (after Rxf2), it's because in this position the knight+queen are more apt at coordinating and creating threats. For example, to see that even after Qxf2 black can win back the rook if desired, here's a line:
 [title "lichess puzzle 61517"]
 [fen "4r1k1/p1b2pp1/1pp2r2/3p2np/1P1P2q1/P3P1P1/2R1NPQP/2R2NK1 b - - 1 28"]

 1...Nh3+ 2.Kh1 Rxf2 3.Qxf2 Nxf2+ 4.Kg2 Nd3 5.Ra1 Qe4+ 6.Kg1 Ne1 7.Rxe1 Qxc2

One must bear in mind that these are tactics problems, and in this case we know white is lost anyhow after Nh3+ but you should solve them with the mindset that you're playing against an engine, that is, assume the best resistance that exists, and sometimes since the position is lost, the best resistance is to delay the unavoidable exactly similar to how engines would go about such lost positions. Therefore, Qxh3 is presumably the move that yields the best resistance (lowest evaluation value for black's advantage from the engine's pov).

-1: <p>I was doing this <a href="https://lichess.org/training/61517" rel="nofollow noreferrer">exercise on lichess</a>, but I don't see why the best move for white is to sacrifice their queen in exchange for a knight (after <code>Nh3+</code>):</p>

<pre><code> [title "lichess puzzle 61517"]
 [fen "4r1k1/p1b2pp1/1pp2r2/3p2np/1P1P2q1/P3P1P1/2R1NPQP/2R2NK1 b - - 1 28"]
</code></pre>
 15078: <p>Because white will lose the queen anyway after <code>Nh3+</code>, since otherwise <code>Kh1</code> is answered with <code>Rxf2</code> trapping and winning the queen. Just try to work out the tactics by yourself. </p>

<p>As to why white doesn't give up the queen for the rook instead (after <code>Rxf2</code>), it's because in <em>this position</em> the knight+queen are more apt at coordinating and creating threats. For example, to see that even after <code>Qxf2</code> black can win back the rook if desired, here's a line:</p>

<pre><code> [title "lichess puzzle 61517"]
 [fen "4r1k1/p1b2pp1/1pp2r2/3p2np/1P1P2q1/P3P1P1/2R1NPQP/2R2NK1 b - - 1 28"]

 1...Nh3+ 2.Kh1 Rxf2 3.Qxf2 Nxf2+ 4.Kg2 Nd3 5.Ra1 Qe4+ 6.Kg1 Ne1 7.Rxe1 Qxc2
</code></pre>

<p>One must bear in mind that these are tactics problems, and in this case we know white is lost anyhow after <code>Nh3+</code> but you should solve them with the mindset that you're playing against an engine, that is, assume the best resistance that exists, and sometimes since the position is lost, the best resistance is to <em>delay</em> the unavoidable exactly similar to how engines would go about such lost positions. Therefore, <code>Qxh3</code> is presumably the move that yields the best resistance (lowest evaluation value for black's advantage from the engine's pov).</p>
