I'll use 'ring' to denote a commutative ring with identity. A Boolean ring is one where every element is idempotent. They turn out to be a particularly nice class of rings; Stone's representation theorem states that every Boolean ring is isomorphic to ring of clopen subsets of a compact Hausdorff space, where addition is symmetric difference and multiplication is intersection. I first learnt of this theorem from Atiyah-Macdonald 1.23--1.25, but I'll be motivating and proving it my own way.
Let's first talk about idempotents in an arbitrary ring $R$. There is a close relationship between idempotents and direct products.
Proposition. $R$ contains an idempotent $\neq0,1$ iff $R$ is a direct product of non-zero rings.
Proof. ($\impd$) If $R=\prod_{i\in I} R_i$, then $(1,0,0,\ldots)$ is an idempotent $\neq0,1$. Generally, if $S\subseteq I$ and $e_S$ is the element of $\prod_{i\in I} R_i$ satisfying
$$i\in S\implies (e_S)_i=1 \quad\text{and}\quad i\notin S\implies (e_S)_i=0,$$
then $e_S$ is an idempotent.
($\imp$) If $e\in R$ is idempotent then so is $1-e$. Then $eR$ and $(1-e)R$ are rings with multiplicative identities $e$ and $1-e$ respectively, and $R\cong eR\times (1-e)R$. $\qed$
Under the isomorphism $R\cong eR\times (1-e)R$, $e$ corresponds to the element $(1,0)$ and $1-e$ corresponds to $(0,1)$. So multiplying by $e$ can be thought of as extracting the first component of some $(a,b)\in R$, and multiplying by $1-e$ as extracting the second component.
If $R$ is Boolean, then $eR$ and $(1-e)R$ are also Boolean, so we can continue decomposing $eR\times (1-e)R$ into a product of 4 Boolean rings, and then a product of 8 Boolean rings, and so on. If $R$ is finite this process will eventually terminate and we obtain $R\cong \F_2^n$ for some $n\in\N$. I'll record this down as a proposition.
Proposition. Every finite Boolean ring is $\F_2^n$ for some $n$.
I'll give two different proofs later on, but the three proofs are not so different from one another; they are 3 different sides of the same 3-sided coin (haha).
The above proposition raises a natural question: is every Boolean ring isomorphic to $\F_2^X$ for some set $X$? The answer turns out to be no: consider the subring of $\F_2^\N$ generated by $1$ and the basis vectors $e_i$. It is Boolean and consists of the sequences with finite and cofinite support, but it cannot be expressed as a product of $\F_2$'s. So, the next best thing we have is Stone's representation theorem.
The simplest kinds of Boolean rings are $\F_2^X$. It's worth studying them because it provides the intuition for general Boolean rings and for the proof. So let's try to derive its spectrum.
First note that elements of $\F_2^X$ correspond naturally to subsets of $X$. Addition corresponds to symmetric difference (which I'll denote as $\Delta$) and multiplication corresponds to intersection. So a prime ideal is a subset $U\subseteq 2^X$ such that
I was immediately reminded of a concept I learned about before. First set $V=U^c$ and then rewrite the statements in contrapositive form, in terms of $V$:
Points 2 and 3 say that $V$ is a filter on $X$, and point 1 looks almost like the statement
$$S\cup T\in V \implies S\in V\ \text{or}\ T\in V,$$
which is equivalent to saying that $V$ is an ultrafilter (see wy.23/12/2021, Proposition 9)!
Proposition. Prime ideals of $\F_2^X$ correspond to ultrafilters on $X$.
Proof. The precise correspondence was mentioned in the above discussion: prime ideals can be treated as subsets of $2^X$, and their complements are ultrafilters.
($\impd$: ultrafilters are complements of prime ideals): We have
$$S\Delta T\in V \implies S\cup T\in V \implies S\in V\ \text{or}\ T\in V,$$
where the first implication follows from upward closure of $V$ and the second follows from $V$ being an ultrafilter.
($\imp$: complements of prime ideals are ultrafilters): We have to show that
$$S\cup T\in V \implies S\in V\ \text{or}\ T\in V.$$
But $S\cup T = (S\Delta T)\Delta(S\cap T)$, so by hypothesis we have $S\Delta T\in V$ or $S\cap T\in V$. In both cases we have $S\in V$ or $T\in V$ as desired. $\qed$
So the points of $\Spec(\F_2^X)$ are ultrafilters on $X$. Each element of $\F_2^X$ has the form $e_S$ where $S\subseteq X$, and we have the basic open sets
$$X_{e_S} = \{\fp\ \text{prime} \mid \fp\not\ni e_S\} = \{U\ \text{ultrafilter} \mid \text{$U^c$ does not contain $S$}\} = \{\text{ultrafilters containing $S$}\}.$$
Proposition. $\spec(\F_2^X)$ is compact and Hausdorff.
Proof. Compactness is a general property of spectrums. Suppose $X=\spec(R)$ is covered by basic open sets $X_{f_i}$. Then the ideal $I$ generated by the $f_i$'s must be $(1)$, otherwise $I$ is contained in some maximal ideal $\fm$. Since $\fm$ contains all $f_i$ and is a point in $X$, $\fm\notin X_{f_i}$ for all $i$ and so $\fm\notin \bigcup_i X_{f_i}$. Thus $\sum_{i\in J} f_i=1$ for some finite subset $I\subseteq J$, and $X=\bigcup_{i\in J} X_{f_i}$.
Now to show $\spec(\F_2^X)$ is Hasudorff. If $U,V$ are two distinct ultrafilters then they contain disjoint subsets $S,T$ respectively. Otherwise, every pair of subsets in $U,V$ has non-empty intersection, so the filter generated by $U$ and $V$ is non-empty, contradicting maximality of $U$ and $V$. There is no ultrafilter containing both $S$ and $T$, because it would also contain $S\cap T=\varnothing$. So $X_{e_S}$ and $X_{e_T}$ are disjoint neighbourhoods of $U$ and $V$. $\qed$
If $|X|=n$, then every ultrafilter is principal and it is easily seen that $\spec(\F_2^n)$ is the discrete topology on $n$ points.
The following proposition is Stone's representation theorem for the special case $\F_2^X$:
Proposition.
Proof. TODO
As I noted, an arbitrary Boolean ring $R$ may not have the form $\F_2^X$ so we can't yet associate elements of $R$ with subsets. But let's pretend that elements of $R$ are subsets anyway. Then the union of two elements $a$ and $b$ would be $a+b+ab$, the intersection would be $ab$, and the complement of $a$ is $1-a$.
In fact, the operations $a\vee b = a+b+ab$ and $a\wedge b = ab$ define a lattice structure on $R$, and the additional operation $\neg a = 1-a$ turns it into a Boolean algebra (i.e. a lattice with complements). Examples of Boolean algebras are power sets and the finite/cofinite subsets of a set. Furthermore, we can define an order on $R$: $a\le b$ iff $a=ab$ (`$a$ is a subset of $b$'), and this turns $R$ into a poset. (Of course one has to check that the axioms of Boolean algebras and posets are satisfied but I'm lazy to do it here.)
With the order and the join/meet operations defined, it makes sense to talk about ultrafilters on $R$. A subset $S\subseteq R$ is an ultrafilter if
TODO