The idea is to look ahead at your possible moves, the possible responses by your opponent to those moves, your responses to your opponent's responses, etc., until you reach some limit. This forms a tree, where the current position is the root and the terminal positions are the leaves. The limit might be a predefined depth (such as "I'll always look four moves deep") or be determined dynamically, based on the situation (such as "I'll look ahead until the situation seems stable").

At that point, a score (value) is assigned to the position. A positive score is good for you; a negative score is good for your opponent. The minimax algorithm propagates the scores of final positions (i.e., leaf nodes to earlier positions by assuming that your opponent will select moves that minimize the score and that you will make moves that maximize the score. So, scores from "deep" moves propagate their way upwards and the path from the root to the best move is the optimal sequence of moves.