A* maintains two lists, called open and closed.
At the beginning of the algorithm, the initial node is placed on the open list. The list is sorted according to a fitness function that measures how close the state of the node is to the goal state. Thus, we are really dealing with priority queues.
At each step, bestNode is removed from the open list. In this case, bestNode is always the head of the open list. If the state of bestNode is the goal state, then the algorithm terminates. Otherwise bestNode is expanded (we determine all the possible states that can be reached within a single move), and bestNode is placed on the closed list.
Ideally the successors of bestNode should be placed on the open list if either:
the successor is not already on the open or closed list, or
the successor is already on the open or closed list but has a lower cost.