user19465: Consider a chess position like this one:
[FEN "K7/4k1p1/8/8/3B4/8/8/8 w - - 0 1"]

1. Ka7 (1. Bxg7) 1... g5 2. Ka6 Kd6 3. Ka5 Kd5 4. Ba7 Kc4 5. Bb6 Kc3 6. Bc5 Kb2 7. Ka4 Ka1 8. Kb3 g4 9. Kc2 g3 10. Bb4 g2 11. Bc5 g1=N (11... g1=Q 12. Bxg1) 12. Bb4 Ne2 13. Bc5 Nc1 14. Ba3 Na2 15. Bb2#

No forced mate is possible there. But a helpmate is possible, so if Black runs out of time, or just plays exceptionally terribly, then White will win. Given that, why does Stockfish pick Bxg7 there, which immediately ends the game in a draw, rather than picking basically any other move (except for the losing Bf6+) to at least have some hope of winning?

user28234: The situation above is that if white makes any move other than Bxg7.
Then black goes g1=Q and has the advantage with the possibility of a win if black can take the bishop.
The table has a list of draws, they all assume that white plays a lot better than ignoring taking a pawn that is about to be promoted.

user28237: Engines are usually coded with the assumption that their opponent will play the best moves that they can imagine, as pointed out by Pat Barron above. This is called a minimax decision rule.
Just to explain why this rule is used - it is a simplifying assumption. If you code or train the engine any other way, you will need two models - one for the opponent, and one for the engine. Using minimax, you only need one model - the engine effectively assumes it is playing itself and acts accordingly.
The idea of exploiting opponents based on a reading of their ability is a very interesting one, but it would be a wholly different challenge to just learning to play chess as well as you can. The problem with an engine that assumes its opponent is weak, is that (for example) you can hustle it by pretending to be weak, and springing a trap. AI algorithms tend to be extremely fragile to exploitative attacks like this, and have limited ability to learn between games to prevent it happening over and over again.

user7147: Unlike playing with people, an engine will make the best move it can find, assuming perfect play on the part of the opponent.  Engines don't play "hope chess" - they don't assume (or hope) that the opponent will make a mistake.

19465: <p>Consider a chess position like this one:</p>
<pre><code>[FEN &quot;K7/4k1p1/8/8/3B4/8/8/8 w - - 0 1&quot;]

1. Ka7 (1. Bxg7) 1... g5 2. Ka6 Kd6 3. Ka5 Kd5 4. Ba7 Kc4 5. Bb6 Kc3 6. Bc5 Kb2 7. Ka4 Ka1 8. Kb3 g4 9. Kc2 g3 10. Bb4 g2 11. Bc5 g1=N (11... g1=Q 12. Bxg1) 12. Bb4 Ne2 13. Bc5 Nc1 14. Ba3 Na2 15. Bb2#
</code></pre>
<p><a href="https://syzygy-tables.info/?fen=K7/4k1p1/8/8/3B4/8/8/8_w_-_-_0_1" rel="noreferrer">No forced mate is possible there</a>. But a helpmate is possible, so if Black runs out of time, or just plays exceptionally terribly, then White will win. Given that, why does Stockfish <a href="https://lichess.org/analysis/standard/K7/4k1p1/8/8/3B4/8/8/8_w_-_-_0_1" rel="noreferrer">pick Bxg7 there</a>, which immediately ends the game in a draw, rather than picking basically any other move (except for the losing Bf6+) to at least have some hope of winning?</p>
 28234: <p>The situation above is that if white makes any move other than Bxg7.</p>
<p>Then black goes g1=Q and has the advantage with the possibility of a win if black can take the bishop.</p>
<p>The table has a list of draws, they all assume that white plays a lot better than ignoring taking a pawn that is about to be promoted.</p>
 28237: <p>Engines are usually coded with the assumption that their opponent will play the best moves that they can imagine, as pointed out by Pat Barron above. This is called a minimax decision rule.</p>
<p>Just to explain why this rule is used - it is a simplifying assumption. If you code or train the engine any other way, you will need two models - one for the opponent, and one for the engine. Using minimax, you only need one model - the engine effectively assumes it is playing itself and acts accordingly.</p>
<p>The idea of exploiting opponents based on a reading of their ability is a very interesting one, but it would be a wholly different challenge to just learning to play chess as well as you can. The problem with an engine that assumes its opponent is weak, is that (for example) you can hustle it by pretending to be weak, and springing a trap. AI algorithms tend to be extremely fragile to exploitative attacks like this, and have limited ability to learn between games to prevent it happening over and over again.</p>
 7147: <p>Unlike playing with people, an engine will make the best move it can find, assuming perfect play on the part of the opponent.  Engines don't play &quot;hope chess&quot; - they don't assume (or hope) that the opponent will make a mistake.</p>
