You can read the precise construction in Hartshorne's proof of the existence of the fiber product. Suppose we have $S$-schemes $X \xrightarrow{f} S$ and $Y \xrightarrow{g} S$. Let $S = \bigcup_i W_i$ be an affine open cover and also take affine open covers $f^{-1}(W_i) = \bigcup_{j} U_{ij}$ and $g^{-1}(W_i) = \bigcup_{j} V_{ij}$ for each $i$. The fiber products $U_{ij} \times_{W_i} V_{ij}$ are just the spectrums of the tensor products of the coordinate rings. Now the fiber product $X \times_S Y$ is constructed by gluing these affine schemes, on certain open subsets, first to $f^{-1}(W_i) \times_{W_i} V_{ij}$, then to $f^{-1}(W_i) \times_{W_i} g^{-1}(W_i)$, and finally over the base to $X \times_S Y$. You can read about the gluing construction in (Marco Lo Guidice's notes, 2.3).
Basically, given schemes $X$ and $Y$ with open subsets $U \subset X$, $V \subset Y$ and an isomorphism $\phi : U \stackrel{\sim}{\to} V$, one constructs the underlying topological space of the gluing by taking the disjoint union of the spaces quotiented by the equivalence relation identifying $u \sim \phi(u)$ for each $u \in U$.
I happen to have a detailed construction of the fiber product of the affine line with double origin with itself that I wrote for homework at some point, here it is. I've just copied and pasted without proofreading again, so there may be typos, etc. $\newcommand{Spec}{\mathrm{Spec}\ }$
Consider the affine schemes $X_1 = \Spec k[x]$, $X_2 = \Spec k[y]$. Between the open subsets $U_1 = \{ (x - a) : a \ne 0 \} \subset X_1$ and $U_2 = \{ (y - b) : b \ne 0 \} \subset X_2$ there is a natural isomorphism $\phi : U_1 \to U_2$. Let $X$ be the scheme obtained by gluing $X_1$ and $X_2$ along $\phi$. Topologically, its points are equivalence classes of the disjoint union of $X_1$ and $X_2$ by the relation $\sim$ under which points $(x - a)$ are identified with their images $(y - a)$, for $a \ne 0$. Let $\bar{U_i} \subset X$ be the images of $U_i$ by the natural maps $X_i \to X$. Note $\bar{U_1} \cap \bar{U_2} = \{ [(x - a)] : a \ne 0 \}$.
To compute the fiber product of $X$ with itself over $\Spec k$, we follow the construction of Hartshorne of the fiber product of general schemes: first we glue $X_1 \times_k X_1$ and $X_2 \times_k X_1$ by certain open sets to obtain $X \times_k X_1$, and we glue $X_1 \times_k X_2$ and $X_2 \times_k X_2$ to obtain $X \times_k X_2$, and then we glue these together to obtain $X \times_k X$. We can compute $X_1 \times_k X_1 = \Spec k[x] \otimes k[x] \cong \Spec k[t_1, t_2]$ and $X_2 \times_k X_1 = \Spec k[y] \otimes k[x] \cong \Spec k[t_3, t_4]$. Let $p_1$ be the first projection map associated with $X_1 \times_k X_1$. Note $p_1$ maps the equivalence class $[(x-a)] = \{(x - a), (y - a)\} \in X$ to $(x - a) \in X_1$ and the class $[(0)] = \{(0)\}$ to $(0) \in X_1$. Now consider the open set $U_1' = p_1^{-1} (\bar{U_1} \cap \bar{U_2}) = \{ (t_1 - a, t_2 - b) : a \ne 0, b \in k \}$. Similarly let $U_2' = p_2^{-1} (\bar{U_1} \cap \bar{U_2}) = \{ (t_3 - a, t_4 - b) : a \ne 0, b \in k \}$, where $p_2$ is the first projection map associated with $X_2 \times_k X_1$. Hartshorne shows that the result of gluing $X_1 \times_k X_1$ and $X_2 \times_k X_1$ via the natural isomorphism $\phi' : U_1' \to U_2'$ is the fiber product $X \times_k X_1$. Topologically we find it is the disjoint union of $X_1 \times_k X_1$ and $X_2 \times_k X_1$ with $(t_1 - a, t_2 - b)$ identified with $(t_3 - a, t_4 - b)$ for all $a \ne 0, b \in k$. Analogously we find $X \times_k X_2$ to be the disjoint union of $X_1 \times_k X_2$ and $X_2 \times_k X_2$ with $(t_1 - a, t_2 - b)$ identified with $(t_3 - a, t_4 - b)$ for all $a \in k, b \ne 0$.
Now we glue $X \times_k X_1$ and $X \times_k X_2$. Let $q_1$ and $q_2$ be the second projection maps associated with $X \times_k X_1$ and $X \times_k X_2$, respectively. Note that $q_1$ maps equivalence classes $[(t_1 - a, t_2 - b)]$ and $[(t_3 - a, t_4 - b)]$ to $(x - b) \in X_1$ and similarly $q_2$ maps them to $(y - b) \in X_2$. Let $U_1'' = q_1^{-1} (\bar{U_1} \cap \bar{U_2})$. This consists of equivalence classes $[(t_1 - a, t_2 - b)] = [(t_3 - a, t_4 - b)]$ with $a \ne 0$, $b \ne 0$, and classes $[(t_1, t_2 - b)]$, $[(t_3, t_4 - b)]$ with $b \ne 0$. Similarly let $U_2'' = q_2^{-1} (\bar{U_1} \cap \bar{U_2})$ consists of the equivalence classes $[(t_1 - a, t_2 - b)] = [(t_3 - a, t_4 - b)]$ with $a \ne 0, b \ne 0$, along with $[(t_1 - a, t_2)]$ and $[(t_3 - a, t_4)]$ with $a \ne 0$. We have an isomorphism $\phi'' : U_1'' \to U_2''$ which maps $[(t_1 - a, t_2 - b)] \mapsto [(t_1 - b, t_2 - a)]$ and $[(t_3 - a, t_4 - b)] \mapsto [(t_3 - b, t_4 - a)]$. The result of gluing $X \times_k X_1$ and $X \times_k X_2$ via $\phi''$ is the fiber product $X \times_k X$.