Why does backtracking work the way it does?
for example 1 and 2 relative to 3 are placed correctly, but 1 relative to 2 is placed incorrectly?


You have already tested that 1 and 2 are placed correctly, otherwise you wouldn't call backtrack(3).

Recall that sol[i] = j means that the queen in column $i$ is put at row $j$.  By calling backtrack(k+1) you have already verified that every queen in $1 \dots k$ are placed correctly (non-colliding).