The bot uses Minimax, a decision algorithm that builds a tree of every possible game from the current position, then picks the move that leads to the best guaranteed outcome, assuming both players play perfectly.
Because tic-tac-toe is a solved game, a perfect Minimax bot will never lose. Two perfect bots always draw, which you can verify with the Bot vs Bot mode above.
To speed things up, the bot also uses Alpha-Beta Pruning: branches of the tree that can't possibly affect the final decision are cut off early, reducing the number of positions evaluated without changing the result.
Learn more: Minimax (Wikipedia) · Alpha-Beta Pruning (Wikipedia)