The extension extracts the current board from chess.com and sends it to the Stockfish API to get the next best move. The API returns the best move in UCI format, which is then displayed in the popup.