Last hand of a blackjack tournament. You know your stack, their stack, and (if you bet after them) their bet. This gives you the bet, in the twenty seconds you have. The math is from the tournament strategy guide; the trainer that drills it is Final Hand.
How it decides
Behind, and they bet small: bet gap + their bet + one chip. That wins both "you win" outcomes. If their double would pass you and you can afford it, cover the double too.
Behind, and they bet big: if a minimum bet leaves you ahead when the dealer beats you both, bet the minimum. The dealer beats a player on roughly 48% of hands, better odds than winning a big bet and needing them to lose. Then stand on your stiffs; you want the dealer to make a hand.
Behind, and a flat bet can't reach: the sizer shows the bet that reaches with a double, or with a natural. If nothing reaches, bet everything except one chip: if the dealer wipes the table you hold the only chips.
Leading: match the threat's bet. Only "they win, you lose" beats you. If their absolute maximum (a natural on their whole stack, 2.5×) can't pass you, bet the minimum and coast.
"Their bet" is the one player you are racing for the advancing spot, usually the stack nearest yours on the wrong side. Rounding is to your chip size, and every target is one chip more than the tie, because a tie usually goes to the player with the button or by another house rule, not to you. Nothing here changes the house edge; it changes which outcome you win the table in.
Sources
Stanford Wong, Casino Tournament Strategy (Pi Yee Press): the chase bet, betting to lose, the held-back chip.
Kenneth R. Smith, blackjackinfo.com tournament series: covering the double, defending a lead.
Michael Shackleford, wizardofodds.com: the dealer-wins and player-wins frequencies used above.
Strategy and education only. Nothing here guarantees a win.