How to directly prove every element in a ring with exactly three ideals is either a unit or a zero divisor? It is known that every element in a ring with finitely many ideals is either a unit or a zero divisor.
Now consider a ring $R$ with exactly three ideals. Take an element $x$ such that $(x)\neq (1)$. For $y\in R$ and $y\notin (x)$, there are two possible cases:


*

*$(y)=(1)$

*$(y)\neq(1)$. Then $(y)=(x)$, that is $x=ys=xts$ for some $s,t\in R$. It follows that $$x(1-ts)=0$$
which implies that $x$ is a zero divisor.
However, if there is no such a $y$ of the second case, how to prove $x$ is a zero divisor?
 A: Suppose $R$ is a commutative ring with only one nonzero proper ideal, $I$ say.

Let $x \in I$, where $x \ne 0$. Since $I$ is a proper ideal, $x$ is not a unit.

Then $(x)$ is a nonzero proper ideal of $R$, hence we must have $I=(x)$.

Suppose $x$ is not a zero divisor.

Then $x^2 \ne 0$, and $(x^2) \subseteq (x)$, so $(x^2)$ is a nonzero proper ideal of $R$.

Hence we must have $I = (x^2)$, and thus, $(x^2) = (x)$.

Then $x = rx^2$ for some $r \in R$, so $x(rx-1)=0$. 

But $x$ is not a zero divisor, hence we must have $rx = 1$, contradiction, since $x$ is not a unit.

Thus, $x$ must be a zero divisor.

Hence, noting that $0$ is also a zero divisor, all elements of $I$ are zero divisors.

Next suppose $y \in R,\;y \notin I$.

Then $y \ne 0$, so $(y)$ is a nonzero ideal with $(y) \ne I$.

It follows that $(y)=(1)$, hence $y$ is a unit.

Thus we've shown that all elements of $I$ are zero divisors, and all elements of $R\setminus I$ are units.
A: Either $(x^2)=(x)$ or $(x^2)=\{0\}$. The former case is impossible, because, by Nakayama's lemma, $(x)$ is generated by an idempotent $e$, but then in that case there would be at least four ideals, $\{0\}$, $eR$ $(1-e)R$ and $R$ among them. 
(Alternatively you can just work out the consequences of $x^2r=x$ assuming $x$ isn't a zero divisor or unit.)
So you only have the first case, where $x^2=0$.

is there a ring $R$ with three exactly ideals $\{0\}$, $\{0,x\}$,  and $R$

Yes, of course: $F_2[x]/(x^2)$.
Actually, for any commutative ring and nonidempotent maximal ideal $M\lhd R$, $R/M^2$ has exactly three ideals, but you went further and specified that the maximal ideal only has two elements...
A: If there is no such a $y$ of the second case, we have to look at $(x)$.
If there exists $z\in (x)$ and $z\neq x$, then we have $(z)=(x)$. Thus, $x=zs=xts$ for some $s,t\in R$. It follows that $x(1−ts)=0$. So $x$ is a zero divisor.
If there is no other element besides $x$, that is, the ring has three ideals：
  $$\{0\},~\{0,x\},~ R$$
If there exists $y\neq x$ and $y\in R$, then $y=1$. Otherwise $\{0,x\}$ is not a ideal. And $x^2=0$, which implies that $x$ is a zero divisor.
