If a ring has $A$ has a module decomposition into a direct sum of ideals, then each ideal is a ring. In page 20 of Atiyah and Macdonald, they claim the following.

Let $A$ be a ring and suppose that $A$ has a module decomposition $A=\mathfrak{a}_{1}\oplus\cdots\oplus \mathfrak{a}_{n}$ of direct sum of ideals. Then, we have $A\cong\prod_{i=1}^{n}(A/\mathfrak{b}_{i})$ where $b_{i}=\bigoplus_{j\neq i}\mathfrak{a}_{j}$. Each ideal $\mathfrak{a}_{i}$ is a ring (isomorphic to $A/\mathfrak{b}_{i}$), the identity $e_{i}$ of $\mathfrak{a}_{i}$ is an idempotent in $A$, and $\mathfrak{a}_{i}=(e_{i})$.


I have proved the first part. That is, $A\cong\prod_{i=1}^{n}(A/\mathfrak{b}_{i})$, as follows. Let $i\in\{1,\cdots, n\}$ be fixed, and it suffices to show that there exists an $A-$module isomorphism $A/\mathfrak{b}_{i}\cong \mathfrak{a}_{i}$. It this were true, then for each $i\in\{1,\cdots, n\}$, we would have an $A-$module isomorphism $\psi_{i}:\mathfrak{a}_{i}\longrightarrow A/\mathfrak{b}_{i}$ and then the desired $A-$module isomorphism $\Phi:A\longrightarrow \prod_{i=1}^{n}(A/\mathfrak{b}_{i})$ could be defined coordinate-wise as $(\psi_{1},\cdots, \psi_{n})$.
Consider the map $\phi_{i}:A\longrightarrow\mathfrak{a}_{i}$ defined by the following rule. If $x\in A$ is written as $x=(x_{1},\cdots, x_{i},\cdots, x_{n})$ where $x_{j}\in \mathfrak{a}_{j}$ for each $j$, then $\phi_{i}(x):=x_{i}$. This map is just a projection onto $i^{th}-$coordinate and thus is surjective, and it clearly satisfies $\phi_{i}(x+y)=\phi_{i}(x)+\phi_{i}(y)$ for any $x,y\in A$. Further, let $a\in A$ and let $x\in\bigoplus_{i=1}^{n}\mathfrak{a}_{i}$, denoted by $\nu$ the action on this direct sum we want to show that $\phi(\nu(a,x))=\mu_{\mathfrak{a}_{i}}(a,\phi(x)):=a\phi(x)$.  Write $x=(x_{1},\cdots, x_{n})$, so that $a\phi(x)=ax_{i}$. On the other hand,
\begin{align*}
\phi(\nu(a,x))=\phi(\nu(a,(x_{1},\cdots, x_{n})))&:=\phi((\mu_{\mathfrak{a}_{1}}(a,x_{1}),\cdots, (\mu_{\mathfrak{a}_{n}}(a,x_{n})))\\
&:=\phi((ax_{1},\cdots, ax_{n}))\\
&:=ax_{i}\\
&=a\phi(x).
\end{align*}
Therefore, $\phi_{i}$ is an $A-$module homomorphism.
Now consider $\ker(\phi_{i})$. We show that $\ker(\phi_{i})\cong b_{i}$. Note that it is easy to check that we have the following $A-$module isomorphism $$\bigoplus_{j\neq i}\mathfrak{a}_{i}\cong \mathfrak{a}_{1}\oplus\cdots\oplus\{0\}\oplus\cdots\oplus\mathfrak{a}_{n},$$ where $\{0\}$ is in the position of the $i^{th}$ summand. Hence, it suffices to show that $\ker(\phi_{i})=RHS$, but this is immediate.
Hence, we have a surjective $A-$module homomorphism $\phi_{i}:A\longrightarrow\mathfrak{a}_{i}$ with the kernel equal to $\bigoplus_{j\neq i}\mathfrak{a}_{i}$, and thus the desired $A-$module isomorphism comes from the first isomorphism theorem.
Is the above proof correct?

Then, I got stuck about why each $\mathfrak{a}_{i}$ is a ring. Do I need to define a multiplication on $\mathfrak{a}_{i}$, check all the axioms of ring? Or this follows directly from the isomorphism? (If so, then why $A/\mathfrak{b}_{i}$ is a ring?)
I believe that if I understand the ring structure of $\mathfrak{a}_{i}$, I will be able to prove the rest of the statement. Thank you in advance for any help!

A side note: I write the "multiplication" on module explicitly as an action $\mu$, because otherwise I got confused really fast.
So by each $\mu_{\mathfrak{a}_{i}}$, I mean the map $\mu_{\mathfrak{a}_{i}}:A\times\mathfrak{a}_{i}\longrightarrow\mathfrak{a}_{i}$ defined by $\mu_{\mathfrak{a}_{i}}(a,x):=ax$ where $ax$ is the usual multiplication on ring (and so consider the ideal as an $A-$module). And by $\nu$, I mean  $\nu:A\times \bigoplus_{i=1}^{n}\mathfrak{a}_{i}\longrightarrow \bigoplus_{i=1}^{n}\mathfrak{a}_{i}$ defined by $$\nu(a,(x_{1},\cdots, x_{n})):=(\mu_{\mathfrak{a}_{1}}(a,x_{1}),\cdots, \mu_{\mathfrak{a}_{n}}(a,x_{n})):=(ax_{1},\cdots, ax_{n}).$$

Another side note, as what comments have pointed out, the context of Atiyah requires ring to be commutative and contain the multiplicative identity $1$. I forget if Aityah also requires $1\neq 0$ to exclude the zero ring.
In this case, ideal is not generally subring because it may not contain $1$.

Edit:
As what I communicated with the accepted answerer, the problem here is that Atiyah did not explicitly the module decomposition is a internal direct sum. The book only defines the external direct sum, without mentioning anything about internal direct sum. Perhaps this is just what they think we should see by ourselves.
If one could see the internal direct sum, then the proof will be clear.
However, there is not much a difference here. See the answer by "Alekos Robotis" in this post: What is internal direct sum or internal direct product in Dummit and Foote?
Basically, external direct sum is equivalent to internal direct sum, up to isomorphism.
In fact, I think that this is what Atiyah and Macdonald want us to see and to prove first as a lemma, in order to prove the claim.
I am really grateful for all the fruitful discussions, not only in this post, but also in MSE about this problem.
 A: As mentioned in the edit of my post, the point here is the relation between external direct sum and internal direct sum.
In other words, to prove the rest of the claim, we need the following lemma:

Lemma: Let $M$ be an $A-$module and let $N_{1}',\cdots, N_{r}'$ be $A-$modules. Suppose that there exists an $A-$module isomorphism $\phi:M\longrightarrow\bigoplus_{i=1}^{r}N_{i}'$ for each $i$. Then, there exists a submodule $N_{i}\subset M$ such that $\phi(N_{i})=N_{i}'$ and for each $m\in M$, there exists a unique tuple $(n_{1},\cdots, n_{r})\in N_{1}\oplus\cdots\oplus N_{r}$ such that $m=\sum_{i=1}^{r}n_{i}$ (which is equivalent to requiring $M=\sum_{i=1}^{r}N_{i}$ and $N_{i}\cap N_{j}=\{0_{M}\}$ for all $i\neq j$).


We now show that each $\mathfrak{a}_{i}$ is in fact a ring. Note that as each $\mathfrak{a}_{i}$ is an ideal, if we can prove that each of them have a multiplicative identity (not necessarily the same identity), then we can conclude that they are subrings of $A$ and thus each of them is a ring by themselves.
To this end, we will utilize the above lemma. By this lemma, as we have an $A-$module isomorphism $\phi:A\longrightarrow\bigoplus_{i=1}^{n}\mathfrak{a}_{i}$. Then, for each $i\in \{1,\cdots,n\}$, there exists a submodule $N_{i}$ of $A$ such that $\phi(N_{i})=\mathfrak{a}_{i}$ and $A$ is an internal direct sum of $N_{i}$'s.
By the isomorphism $\phi:N_{i}\longrightarrow\mathfrak{a}_{i}$, it suffices to show that $N_{i}$ is a ring. If $N_{i}$ was a ring, then the multiplicative identity of $N_{i}$ would be sent to the multiplicative identity of $\mathfrak{a}_{i}$ via $\phi$, and thus $\mathfrak{a}_{i}$ would also be a ring.
However, as $A$ is actually a ring and the submodule $N_{i}\subset A$ preserves the multiplication, it follows that each $N_{i}$ is in fact an ideal of $A$. So, as long as $N_{i}$ has a multiplicative identity, then $N_{i}$ is a ring. Therefore, the problem basically comes down to find a multiplicative identity in $N_{i}$.
To this end, note that by the internal direct sum, the multiplicative identity $1_{A}\in A$ can be uniquely expressed as $$1_{A}=x_{1}+\cdots+x_{n},\ \text{where}\ x_{i}\in N_{i}\ \text{for each}\ i.$$ And we claim that each $x_{i}$ is the multiplicative identity of $N_{i}$, and thus each $e_{i}:=\phi(x_{i})$ is the multiplicative identity of $\mathfrak{a}_{i}$.
Let $a\in N_{i}\subset A$, then we have that $a=a1_{A}=\sum_{i=1}^{n}ax_{i}$. Note that since each $N_{j}$ is closed under multiplication from $A$, we know that $ax_{j}\in N_{j}$, but as $N_{i}$ is an ideal, considering $x_{j}$ as an element in $A$, it follows that $ax_{j}\in N_{i}$ is also true. Therefore, $ax_{j}\in N_{j}\cap N_{i}$. But for $i\neq j$, $N_{j}\cap N_{i}=\{0\}$, and thus $a=a1_{A}=\sum_{i=1}^{n}ax_{i}=ax_{i}.$ This means that $a=ax_{i}$ and thus $x_{i}$ is the identity.
Hence, $e_{i}:=\phi(x_{i})$ is the identity of $\mathfrak{a}_{i}$, and thus each $\mathfrak{a}_{i}$ is a ring. To show that $e_{i}$ is an idempotent in $A$, let $a\in N_{i}$, then $\phi(a)\in \mathfrak{a}_{i}$, and since $\phi(x_{i})$ is the multiplicative identity in $\mathfrak{a}_{i}$, we have $\phi(a)\phi(x_{i})=\phi(a)$. Since this equation holds for all $a\in N_{i}$, in particular it holds for $a:=x_{i}$, which leads us to $$e_{i}e_{i}=\phi(x_{i})\phi(x_{i})=\phi(x_{i})=e_{i},$$ and thus $e_{i}$ is an idempotent.
Finally, to show that $\mathfrak{a}_{i}=(e_{i})$, we only need to prove the equality considering $(e_{i})$ as a principle ideal. We do not need to go to the level of module because we are in a special case here. Let $a\in \mathfrak{a}_{i}$, then $a=a e_{i}$ and thus $a\in (e_{i})$. Conversely, let $x\in (e_{i}),$ then $x=\sum_{j=1}^{r} x_{j}e_{i}$ where $x_{j}\in A$. As $e_{i}\in \mathfrak{a}_{i}$ and $\mathfrak{a}_{i}$ is an ideal, it follows that $x_{j}e_{i}\in\mathfrak{a}_{i}$ for each $j$, and thus so is their sum, and thus $x\in \mathfrak{a}_{i}$.
The proof is concluded.
A: Your proof looks right. Now you can prove that each $\mathfrak{a}_i$ is a ring
They certainly are subrngs of $A$, because they're ideals. The only thing to check is that they have an identity. Write
$$
1=e_1+e_2+\dots+e_n,\qquad e_i\in\mathfrak{a}_i
$$
Such a decomposition is unique. Take $a\in\mathfrak{a}_i$; then
$$
a=a1=\sum_{1\le j\le n}ae_j=ae_i
$$
because for $i\ne j$ we have $ae_j\in\mathfrak{a}_i\cap\mathfrak{a}_j=\{0\}$. So $e_i$ is an identity for $\mathfrak{a}_i$ and, in particular, it is idempotent.
For a fixed $i$, the map $A\to\mathfrak{a}_i$ defined by $a\mapsto ae_i$ is a ring homomorphism. Check that its kernel is $\mathfrak{b}_i$.
A: Your first proof looks good.
Notice that the $A$-module map $A\to A/\mathfrak b_i$ is also a ring map, i.e. the ring structure on $A/\mathfrak b_i$ is the same as its $A$-module structure. Then the isomorphism $A/\mathfrak b_i\to \mathfrak a_i$ induces a ring structure on $\mathfrak a_i$ (the ring structure on $\mathfrak a_i$ is also the same as its $A$-module structure, and the multiplicative identity is the image of $1+\mathfrak b_i$).
