Localization is much easier conceptually when $R$ is a domain, as in that case we can work with the simpler equivalence relation $\frac{r_1}{s_1} \sim \frac{r_2}{s_2}$ if and only if $s_2 r_1 = s_1 r_2$.
Indeed, you can check that this is an equivalence relation provided $S$ doesn't contain any zero divisors.
The question, then, is what goes wrong in the case that $S$ does have a zero divisor. Well, everything works fine except for transitivity. If we say $\frac{r_1}{s_1} \sim \frac{r_2}{s_2} \sim \frac{r_3}{s_3}$, then we compute $r_1 s_3 s_2 = r_3 s_1 s_2$. Again, if $s_2$ is not a zero divisor then we can cancel it and see $\frac{r_1}{s_1} \sim \frac{r_3}{s_3}$, but if $s_2$ is a zero divisor then we have an issue.
Thankfully, this issue is easily repaired! If $s_2$ is a zero divisor then we can derive $s_2 (r_1 s_3 - r_3 s_1) = 0$ by rearranging the last equality. From here it's an easy check that we get an equivalence relation if we make move the goalposts a little bit to account for this.
Then, like all good mathematicians, we cover our tracks. We can't let people know that we wanted a simple equivalence relation and failed. So instead we say that all along we wanted our equivalence relation to be $\frac{r_1}{s_1} \sim \frac{r_2}{s_2}$ if and only if, for some $s'$, we have $s' (r_1 s_2 - r_2 s_1) = 0$. And would you look at that, everything works out nicely!
More conceptually, we now know that the issue comes when $S$ contains a zero divisor. So let's just... kill all of the witnesses to zero-divisor-ness in $S$. That is, let $I$ be the ideal of elements $r$ so that $rs = 0$ for some $s \in S$.
Then it's easy to see that in $R/I$, the subset $S/I$ is still multiplicative, so we can use the easier definition in $R/I$. It's not hard to check that the composite
$$R \to R/I \to R/I[(S/I)^{-1}]$$
satisfies the desired universal property of localizations.
From here it's not hard to check (using the definition of $I$) that the easier definition in $R/I$ lifts to the more complicated definition in $R$.
I hope this helps ^_^