You can really think of tuning an antenna as a 2 dimensional problem.
On one hand, you want to have the antenna resonate. That means that the reactive part of the impedance should go to zero. You typically control this by changing the length of the antenna so that it is electrically like a quarterwave.
On the other hand, when it resonates, you would like the real part of the impedance to be 50 ohms. So you have to vary something else to do this, because you have a fixed length to get it onto resonant frequency. Sometimes you vary the diameter of the conductor, or add lumped reactance matching network, or whatever.
But it is basically solving two somewhat independent equations, where one of the variables is the antenna length, and the other variable is the matching network operation.