Question: "Can someone give me some motivation to why the relation is modified in this way?Also,I want to know what localization means geometrically in the context of algebraic geometry."
Answer: If $S \subseteq A$ is a multiplicative subset it follows the localized ring $S^{-1}A$ satisfies the following universal property: For any map of commutative rings $f:A \rightarrow B$ where
$$f(s)\text{ is a unit for all }s\in S,$$
$$f(a)=0\text{ it follows there is an element $s\in S$}as=0$$
$$\text{Every element $b\in B$ is of the form $f(a)f(s)^{-1}$}$$
there is a unique isomorphism of rings $F: S^{-1}A \rightarrow B$ such $F \circ p =f$ where $p: A \rightarrow S^{-1}A$ is the canonical map. This property characterize the localization up to isomorphism.
This enables you to localize rings that are not integral domains, and this agrees with your "topological intuition". If $\mathfrak{p} \in U \subseteq Y:=Spec(T)$ with $U$ an open set you get isomorphisms
$$\mathcal{O}_{Y, \mathfrak{p} } \cong \mathcal{O}_{U,\mathfrak{p} }$$
of local rings.
Example: Direct sums. The prime ideals in the direct sum $R:= A\oplus B$ are of the form $I:=\mathfrak{p}⊕B$ (or vice versa), and if you localize $R$ at $I$ you get
$$R_I≅A_{\mathfrak{p}}.$$
The isomorphism $R_I \cong A_{\mathfrak{p}}$ agrees with the intuition that the stalk at a point can be calculated using any open set containing the point: $X_1 \subsetneq X$ is an open subset and you may restrict to $X_1$ to calculate the local ring at $I$: There is an isomorphism
$$R_I \cong \mathcal{O}_{X,I} \cong \mathcal{O}_{X_1, \mathfrak{p}} \cong A_{\mathfrak{p}}.$$