A question about the equivalence relation on the localization of a ring.

You have to think in the case that $A$ is not an integral domain. For example, consider $\mathbb{Z}_8$. Make $a_1=a_3=\overline{1},a_2=s_1=\overline{2}, s_2=\overline{4}$ and $ s_3=\overline{6}$. We have $$a_1s_2=\overline{1}.\overline{4}=\overline{2}.\overline{2}=a_2s_1$$ $$a_2s_3=\overline{2}.\overline{6}=\overline{4}=\overline{1}.\overline{4}=a_3s_2$$ and $$a_1s_3=\overline{1}.\overline{6}=\overline{6}\neq\overline{2}=\overline{1}.\overline{2}=a_3s_1.$$


For a more geometric example, let $A = \mathbb{R}[x,y] / (xy)$ and $S = \{ 1, x, x^2, x^3, \ldots \}$. (In algebraic geometry, $A$ represents a ring of functions on the union of the two axes in $\mathbb{R}^2$.) Then in $S^{-1} A$, $y/1 = 0/1$ even though $y \cdot 1 - 0 \cdot 1 \ne 0$ in $A$ - but in fact, $x (y \cdot 1 - 0 \cdot 1) = 0$.

Intuitively, the reason $y = 0$ must hold in $S^{-1} A$ is that $xy = 0$ is inherited from $A$, and then you can multiply both sides by $x^{-1}$. (The localization corresponds to the geometric operation of intersecting with the set where $x \ne 0$.)