If a subring of a ring R has identity, does R also have the identity?
$0*0=0$. The set {0} is a subring of any ring and in it 0 is the identity.
Let $\mathbb R^{(\left\{1,2,3,...\right\})}$ be the subring of $\mathbb R^{\left\{1,2,3,...\right\}}$ consisting of all $\left(a_1,a_2,a_3,...\right)$ such that all but finitely many $i\in\left\{1,2,3,...\right\}$ satisfy $a_i = 0$. Then, $\mathbb R^{(\left\{1,2,3,...\right\})}$ is a (strictly) nonunital ring, but its subring formed by all $\left(a_1,a_2,a_3,...\right)$ such that all $i \geq 2$ satisfy $a_i = 0$ is a unital ring.
No. Here's a simple counterexample: consider the set $R$ of $3 \times 3$ matrices of the form
$\begin{bmatrix} 2n & 0 & 0 \\ 0 & a & b \\ 0 & c &d \end{bmatrix}, \tag{1}$
where $n, a, b, c, d \in \Bbb Z$, $\Bbb Z$ being the ring of integers. It is easy to see that $R$ is indeed a ring, and that the subring characterized by $n = 0$ is a subring with identity element given by taking $a = d = 1$ and $b = c = 0$. The subset with $a = b = c = d = 0$ is also a subring, but without identity. The ring $R$ has no (multiplicative) identity. To obtain a commutative example, simply take $c = d = 0$. QED.
The above example can obviously be generalized in several directions, e.g., we can take the matrices to have size greater than $3$.
Hope this helps! Cheers,
and as always,
Fiat Lux!!!
Let $R=\Bbb Q\times 2\Bbb Z$: then $R$ is non-unital, but the ideal $\Bbb Q\times\{0\}$ is unital. Of course this construction generalizes to produce lots of examples of the form $R_1\times R_0$, where $R_1$ is unital and $R_0$ is not.
More interesting is a generalization of darij grinberg’s answer. Let $X$ be any non-compact zero-dimensional space, and let $R$ be the ring of continuous real-valued functions on $X$ with compact support; clearly $R$ is not unital. However, if $K$ is a compact open subset of $X$, the ideal of functions supported on $K$ is unital, with unit $\chi_K$. An example of such an $X$ is $C\setminus\{1\}$, where $C$ is the middle-thirds Cantor set. (The $p$-adic numbers are homeomorphic to this space.)