How is entropy a state function?
Your question goes right in the kernel of the meaning of the term state function.
A state function is a function defined over all possible states of the system such that its value for every state does not depend on how the system reached the state. Each state has a definite and unique value for the given state function.
The state $A$ has a definite value for the state function entropy, $S(A)$. The same for the state $B$, which gives $S(B)$. Thus the difference in entropy between the states $A$ and $B$ is simply $\Delta S=S(B)-S(A)$ and this value does not depend on the process that takes $A$ to $B$. The difference $\Delta S$ between $A$ and $B$ exists even for irreversible paths and it has always the same value.
In the case of entropy, there is some subtlety though. The way we calculate the difference $\Delta S$ is always $$\Delta S=\int_{\mathrm{rev}}\frac{dQ}{T},$$ where the integral has to be computed through a reversible process. There is a plenty of reversible process from $A$ to $B$ but we just choose the simplest one for calculations.
There are generally many reversible paths between different states. As an example consider a Carnot cycle. If I start at the beginning of the cycle at the point where the working medium is fully contracted I can, since every step is reversible, get to the point half way through, where the working medium is fully expanded, by going around the cycle in either direction, giving me two different paths between the two states.
Notice however that both these paths have two stages. On one you expand isothermally and then adiabatically, and on the other you apply the same steps in the reverse order.
There are, however, limits on which states can be accessed on certain types of path. In particular you can only move between two states adiabatically if they lie on the same adiabat and can only move between them isothermally if they lie on the same isotherm.
The total heat added in both the processes is different. Infinitesimal change in entropy is defined as $\int(dQ/T)$. Along the isotherm, the temperature remains constant. But along the other two reversible processes you have mentioned, the temperature is not constant. Effectively, it can be seen by integration that change in entropy in both processes is the same.