Relative Spec (the structure map) Given a scheme $S$ and a quasi coherent sheaf $\mathcal{F}$ of $\mathcal{O}_S$ algebras, we want to define a scheme $X = \mathrm{Spec}(\mathcal{F})$ over $S$. To do so, we define it in three stages: as a set, as a topological space, and then give a structure sheaf. 
As a set, we define $\mathrm{Spec}(\mathcal{F})$ to be the set of prime ideal sheaves in $\mathcal{F}$, that is, quasi coherent sheaves $\mathcal{P}$ of ideals such that for every $U \subset S$ open, the ideal $\mathcal{P}(U)$ is either prime or the unit ideal. 
As a topological set, given $U \subset S$ and $\sigma \in \mathcal{F}(U)$, the sets 
$$V_{U,\sigma} = \{ \text{prime ideal sheaves $\mathcal{P} \subset \mathcal{F}$ such that $\sigma \notin \mathcal{P}(U)$}\}$$
for a topology. 
Finally we set $\mathcal{O}_X(V_{U,\sigma}) = \mathcal{F}(U)[\sigma^{-1}]$ for the structure sheaf. 
The problem arises while defining the morphism $f \colon X \to S$. In Eisenbud-Harris The Geometry of Schemes, it states that as a map of topological spaces, $f \colon X \to S$ is given by sending a prime ideal sheaf $\mathcal{P} \subset \mathcal{F}$ to its inverse image under the morphism of sheaves $\mathcal{O}_S \to \mathcal{F}$, and the pullback map 
$$f^{\#} \colon \mathcal{O}_S(U) \to f_* \mathcal{O}_X$$
is given by the structure map $\mathcal{O}_S \to \mathcal{F}$ on $U$. 

What is exactly meant by "the inverse image in $\mathcal{O}_s \to \mathcal{F}$"? How does that give us a continuous map on the underlying topological spaces of $X$ and $S$? 

 A: As $\mathcal{F}$ is a quasicoherent $\mathcal{O}_S$-algebra you have a morphism $\varphi:\mathcal{O}_S \rightarrow \mathcal{F}$, i.e, for each $U\subseteq S$ you have a ring morphism $$\varphi_U:\mathcal{O}_S(U)\rightarrow \mathcal{F}(U)$$
And hence given a prime ideal sheaf $\mathcal{P}\subseteq \mathcal{F}$you can consider $\varphi^{-1}(\mathcal{P})$ as the sheaf given by $\varphi^{-1}(\mathcal{P})(U)=\varphi_U^{-1}(\mathcal{P}(U))$. 
As the preimage of a prime ideal of a ring is prime we have that $\varphi^{-1}(\mathcal{P})$ is also a prime ideal sheaf (it is not difficult to see that it is quasicoherent as well). Hence it will correspond to a point $p\in S$ as follows: on an affine chart $\text{Spec}(A)=U\subseteq S$ in which $\mathcal{P}(U)\neq (1)$, the ideal sheaf $\varphi^{-1}(\mathcal{P})$ will correspond to the $\mathfrak{p}\in \text{Spec}(A)$ such that $\tilde{\mathfrak{p}}=\varphi^{-1}(\mathcal{P})(U)$. It is not hard to show that this point doesn't depend in the affin chart. This construction give us a map between sets $f:\text{Spec}(\mathcal{F})\rightarrow S$.
Let's prove is continuous. For this first you should prove that for each $U\subset S$ there is a natural identification between the sets $\text{Spec}(\mathcal{F}\mid_U)$ and $f^{-1}(U)$. Hence it is enough to prove that the function is continuous for $S$ affine. Take $D(a)$ a basic open set in $S$, we have $$\mathcal{P}\in f^{-1}(D(a)) \iff [\varphi^{-1}(\mathcal{P})]\in D(a) \iff a\notin(\varphi^{-1}(\mathcal{P}))(S) \iff \varphi_S(a)\notin \mathcal{P}(S)\iff \mathcal{P}\in V_{S,\varphi(a)}$$
Therefore $f^{-1}(D(a))=V_{S,\varphi(a)}$ and so $f$ is continuous.
Finally in order to define the map $f^\sharp:\mathcal{O}_S\rightarrow f_*\mathcal{O}_X$ if $S$ is affine you just notice that $\mathcal{O}_S(D(a))=\mathcal{O}_S(S)_a$ and $f_*\mathcal{O}_X(D(a))=\mathcal{O}_X(V_{S,\varphi(a)})=\mathcal{F}(S)_{\varphi(a)}$ so we can take $f^\sharp_{D(a)}=\varphi_a$ and if $S$ is not affine you take an affine cover $S=\bigcup U_i$ and use the construction under each of the restrictions $f^{-1}(U_i)\rightarrow U_i$.
