I've found in an exercise this statement:
If $A$ is a commutative ring with unit and $A = A_{1} \times \dots \times A_{n}$ then $$\def\Spec{\operatorname{Spec}} \Spec(A) \cong \Spec(A_{1})\times \dotsb \times \Spec(A_{n})$$ Why is this true ?
I've found in an exercise this statement:
If $A$ is a commutative ring with unit and $A = A_{1} \times \dots \times A_{n}$ then $$\def\Spec{\operatorname{Spec}} \Spec(A) \cong \Spec(A_{1})\times \dotsb \times \Spec(A_{n})$$ Why is this true ?
This is not true. Direct products of rings correspond to disjoint unions of affine schemes. Tensor products, on the other hand, correspond to fibre products (in particular, products) of affine schemes.
Explicitly,
$$\operatorname{Spec}(A_1\times\cdots\times A_n) \cong \operatorname{Spec}(A_1)\sqcup\cdots\sqcup \operatorname{Spec}(A_n)$$ and
$$\operatorname{Spec}(A_1\otimes_R A_2) \cong \operatorname{Spec}(A_1)\times_{\operatorname{Spec} R}\operatorname{Spec}(A_2).$$
The reason for this is that the functor $\operatorname{Spec}$ is a contravariant equivalence from the category $\operatorname{Ring}$ of commutative unital rings to the category $\operatorname{Aff}$ of affine schemes. In particular, it sends (fibre) products to (fibre) coproducts, and vice versa. The product in $\operatorname{Ring}$ is the cartesian product $\times$ and the coproduct in $\operatorname{Aff}$ is disjoint union $\sqcup$, giving the first statement above. The fibre coproduct in $\operatorname{Ring}$ is given by the tensor product, giving the second statement above.
Without resorting to abstract nonsense, we can see the bijection between $\operatorname{Spec}(A_1\times A_2)$ and $\operatorname{Spec}(A_1)\sqcup\operatorname{Spec}(A_2)$ as follows: the prime ideals of $A_1\times A_2$ are of the form $\mathfrak{p}\times A_2$ where $\mathfrak p$ is a prime ideal of $A_1$, or $A_1\times\mathfrak q$ where $\mathfrak q$ is a prime ideal of $A_2$.
This isn't true. Consider the simple case where $A_1 = A_2 = \mathbb{C}[x]$. Then $Spec(A_i) = \mathbb{C}$.
However, $Spec(A_1 \times A_2) = \mathbb{C} \sqcup \mathbb{C}$, not $\mathbb{C}^2 = Spec(A_1 \otimes A_2)$.
$\newcommand\Spec{\operatorname{Spec}}$The direct product of the rings $(A_i)_{i\in I}$ equals the disjoint union of the spectra if and only if $I$ is finite (see this). That is, the inclusion $\text{Aff}\to\text{LRS}$ does not preserve coproducts in general (where $\text{LRS}$ is the category of locally ringed spaces). What's true for formal reasons is that $\Spec(A_1\otimes_R A_2)=\Spec A_1\times_{\Spec R}\Spec A_2$, for the functor $\Spec:\text{Ring}^\mathrm{op}\to\text{LRS}$ is a right adjoint, so it preserves all limits. But we need a non-formal argument to show that that $\Spec(A_1\times A_2)$ is the coproduct of $\Spec A_1$ and $\Spec A_2$ in the category of locally ringed spaces (i.e., it equals the disjoint union of the spectra). Such an argument is to be found for instance in 00ED and 01I5.
This result has the following intuitive meaning: if $M$ is a smooth (resp., complex) manifold and $\mathcal{O}_M$ is the structure sheaf of smooth real-valued (resp., holomorphic complex-valued) functions, then $\Gamma(M,\mathcal{O}_M)=\prod_{C\subset M}\mathcal{O}_M(C)$, where $C$ moves across the connected components of $M$ (which is a locally connected topological space, so its connected components are open). If the spectrum of a ring $A$ is to be thought of as the geometric space whose functions are the elements of $A$, then the isomorphism of affine schemes $$ \tag{1}\label{1} \Spec(A_1\times A_2)\cong\Spec(A_1)\amalg\Spec(A_2) $$ can be understood in analogy with the smooth/complex manifold situation. (Note that this fails for the infinite ring product, see this.) Actually, in the classical setting it's more than analogy: a finite disjoint union of classical affine k-varieties is again a classical affine k-variety (here's the question addressing this issue). In the case $\overline{k}=k$, this follows from the classical-schematic equivalence (see here or here) plus the isomorphism \eqref{1} and the fact that finitely-generated reduced k-algebras are stable under finite direct products.
Lemma. $\operatorname{Spec}(A\times B)=\operatorname{Spec}(A)\sqcup\operatorname{Spec}(B)$.
Proof. Take an element $\mathfrak p$ of $\operatorname{Spec}(A\times B)$ and define $$ \mathfrak p_A=\pi_A(\mathfrak p)\quad\text{and}\quad\mathfrak p_B=\pi_B(\mathfrak p), $$ where $\pi_A$ and $\pi_B$ are the projections. Note that $\mathfrak p_A$ is an ideal that satisfies $aa'\in\mathfrak p_A\implies a\in\mathfrak p_A$ or $a'\in\mathfrak p_A$. Thus, if $\mathfrak p_A$ is proper, it is prime in $A$. Similarly for $\mathfrak p_B$. It follows that $\mathfrak p_A\times B$ (resp. $A\times\mathfrak p_B$) is prime when $\mathfrak p_A$ (resp. $\mathfrak p_B$) is proper.
Claim: One, and only one, of $\mathfrak p_A$ and $\mathfrak p_B$ is proper.
Indeed. Suppose that $1\notin\mathfrak p_A$. Pick $b\in\mathfrak p_B$. There exists $a\in A$ such that $(a,b)\in\mathfrak p$. Therefore, $(a,1)(1,b)=(a,b)\in\mathfrak p$. But $(1,b)\notin\mathfrak p$, or we would have $1\in\mathfrak p_A$, which is not. Hence, $(a,1)\in\mathfrak p$, implying that $1\in\mathfrak p_B$. In other words, not both of them are proper. Moreover, in case $\mathfrak p_A$ is proper, we also have $\mathfrak p_A\times B\subseteq\mathfrak p$. Conversely, if $(a,b)\in\mathfrak p$, then $a\in\mathfrak p_A$ and so $(a,b)\in\mathfrak p_A\times B$, i.e., equality is attained. Finally, suppose that $\mathfrak p_A=A$ and $\mathfrak p_B=B$. Then $(1,b)\in\mathfrak p$ for some $b\in B$ and $(a,1)\in\mathfrak p$ for some $a\in A$. It follows that $(1,1) = (1,0)(1,b) + (0,1)(a,1) \in\mathfrak p$, which is impossible. The claim is now clear.
We conclude that $$ \operatorname{Spec}(A\times B) \subseteq \operatorname{Spec}(A)\sqcup\operatorname{Spec}(B). $$ Since the other inclusion is obvious, equality is attained.