Q:

Defining an $R$-module by using a ring homomorphism.

From Algebra by Hungerford:

Let $R$ and $S$ be rings and $\phi: R \rightarrow S$ a ring homomorphism. Then every $S$-module $A$ can be made into an $R$-module by defining $rx$ $(x \in A)$ to be $\phi(r)x$. One says that the $R$-module structure of $A$ is gen. by pullback along $\phi$.

I find this a bit confusing, because $\phi(r) \in S$ and not in $R$. Then how do we get an $R$-module if the scalars are from $S$? 

A:

You already have an $S$-module, so $\phi(r)x$ is already defined.  By defining $rx$ to have this same value, you have defined how to multiply elements of $A$ by scalars in $R$.  After checking some equations, you find that this new multiplication makes $A$ into an $R$-module.

A:

The datum of an $S$-module structure on an abelian group $A$ is precisely a ring homomorphism $\rho: S \rightarrow \operatorname{End}_{\text{Ab}}A$ where $\operatorname{End}_{\text{Ab}}A$ denotes the endomorphism ring of $A$. Indeed, defining $\rho(s)(a) = s \cdot a$ for every $s \in S$ and $a \in A$, it is straightforward to check that the module axioms are equivalent to the assertion that $\rho$ is a ring homomorphism.
Therefore given a ring homomorphism $\phi: R \rightarrow S$, the composite ring homomorphism $ \rho \circ\phi: R \rightarrow \operatorname{End}_{\text{Ab}}A$ puts an $R$-module structure on $A$.

