I am studying from Patrick Morandi's Field and Galois Theory, and on page 32 he proves the existence of an algebraic closure of an arbitrary field, as follows:
Lemma 3.13. If $K/F$ is algebraic, then $|K| \leq \max\{ |F|,|\mathbb{N}| \}$.
Theorem 3.14. Let $F$ be a field. Then $F$ has an algebraic closure.
Proof. Let $S$ be a set containing $F$ with $|S| > \max\{ |F|, |\mathbb{N}| \}$. Let $\mathcal{A}$ be the set of all algebraic extension fields of $F$ inside $S$. Then $\mathcal{A}$ is ordered by defining $K \leq L$ if $L$ is an extension field of $K$. By Zorn's lemma, there is a maximal element $M$ of $\mathcal{A}$. We claim that $M$ is an algebraic closure of $F$. To show that $M$ is algebraically closed, let $L$ be an algebraic extension of $M$. By Lemma 3.13, $$ |L| \leq \max\{ |M|, |\mathbb{N}| \} \leq \max\{ |F|,|\mathbb{N}| \} < |S|. $$ Thus, there is a function $f:L \to S$ with $f|_M = \operatorname{id}$. By defining $+$ and $\cdot$ on $f(L)$ by $f(a) + f(b) = f(a+b)$ and $f(a) \cdot f(b) = f(ab)$, we see that $f(L)$ is a field extension of $M$ and $f$ is a field homomorphism. Maximality of $M$ shows that $f(L) = M$. Thus, $M$ is algebraically closed. Since $M$ is algebraic over $F$, we see that $M$ is an algebraic closure of $F$. $\tag*{$\blacksquare$}$
I do not understand the second line in the proof, where he says
Let $\mathcal{A}$ be the set of all algebraic extension fields of $F$ inside $S$.
Since we are assuming $S$ is just a set containing $K$ and so it does not have any field structure defined on it a priori, how can we talk about field extensions of $F$ contained in $S$?
The rough idea that I am currently keeping in mind is that we take an algebraic extension $K$ of $F$ and then use a bijection of this set onto a subset of $S$ to define the addition and multiplication on this subset, in the same way we do later on for $L$. And then we possibly do this process for every algebraic extension of $K$.
But then what I don't see at all is how to ensure that the different mappings are compatible with each other. And, if I have two isomorphic algebraic extensions of $K$, do I then map it to the same subset of $S$ or something?
It would be really helpful if someone could guide me in filling out the details here.
You are overthinking this. You are correct that $S$ is just a set. An element of $\mathcal{A}$ is a subset $K$ of $S$ together with a field structure on $K$ such that this field structure makes $K$ an algebraic field extension of $F$. A subset of $S$ on its own does not automatically get a field structure, but specifying an element of $\mathcal{A}$ involves choosing one particular field structure to put on your subset.
The whole point of the Zorn's lemma argument is then to avoid the mess you describe about figuring out how to compatibly embed all possible algebraic extensions into $S$. You just pick a maximal algebraic extension of $F$ whose underlying set is subset of $S$. Then, as argued in the proof, maximality guarantees that this field is algebraically closed.