I am trying to understand localization of a commutative ring, and when it can be $0$. I confused with some examples and came up to some questions, whose partial answers I couldn't convinced myself. (Definition and notation of localization is recalled after questions.)
Claim 1. If $0\in S$ then $R_S=0$
for consider $(1,1)$ and $(0,1)$. Then $(1,1)\sim (0,1)$ because taking $t=0$ in definition, we have $(1.1-0.1)0=0$. So multiplicative identity is $0$, which forces $R_S=0$.
Claim 2. Even if $0\notin S$, it can happen that $R_S=0$.
Proof: We give example: Consider $\mathbb{Z}/12$, and write its elements as integers $0,1,\cdots,11$, with operations mod 12. Take $S=\{1,3,6,9\}$. Then $S$ is multiplicatively closed in the ring.
In $R_S$, the (image of) $6$ becomes unit. Since $2.6=0$ we get that $2=0$ in $R_S$.
Next, since $6$ is unit and $6=2.3$, and as $2=0$, we get that $6$ is equal to $0$.
Thus, in $R_S$ we have shown that a unit is zero, which forces that $R_S=0$.
Question 1. If $0\in S$ then $R_S=0$; is this correct (with proof given in claim 1)?
Question 2. The above example shows $R_S$ can be zero even if $0\notin S$. Is this assertion and example correct?
Question 3. What is necessary and sufficient condition on $S$ for $R_S$ to be non-zero?
Let $R$ be a commutative ring with unity $1$ different from zero. Let $S$ be a multiplicative subset of $R$ containing $1$ (so $x,y\in S$ implies $xy\in S$).
On $R\times S$, we define $(r,s)\sim (r',s')$ if there is $t\in S$ such that $(rs'-r's)t=0$.
Let $R_S=(R\times S)/\sim$ denote the localization of $R$ at $S$. Write equiv. class of $(r,s)$ by $r/s$.
In the localization $R_S$, the element $1/1$ is multiplicative, and $0/1$ is additice identity.
Your example $2$ is incorrect. The set $S=\{1,3,6,9\}$ is not multiplicatively closed: $6\times 6=0$ in $\Bbb Z/12\Bbb Z$ but $0\notin S$.
In fact $R_S=0$ iff $0\in S$. To prove this, note that $1/1=0/1$ in $R_S$ iff there exists $s\in S$ with $s(1-0)=0$.