Let $\psi: R \to S$ be a ring homomorphism. Composing $\psi$ with the inclusion of $S$ as a subring of the polynomial ring $S[x]$, we obtain a homomorphism $\phi :R \to S[x]$. The substitution principle (see below) asserts that there is a unique extension of $\phi$ to a homomorphism $\Phi: R[x] \to S[x]$ that sends $x\leadsto x$.
What does it mean by "composing $\psi$ with the inclusion of $S$ as a subring of the polynomial ring $S[x]$, we obtain a homomorphism $\phi :R \to S[x]$"? What is the inclusion of $S$ as a subring of the polynomial ring $S[x]$? Could you give a simple example to explain it?

You can write $$ S[x] = \left\{ \sum_{k=0}^d s_k x^k ~\text{for some degree}~d\in\Bbb{N}~\text{and}~s_0,\ldots,s_d\in S~\text{with}~s_d\ne0\right\} $$ This set contains the set $S$ as all polynomial expressions of degree $d=0$, i.e. expressions that are simply of the form $s$ with $s\in S$. By defining $\iota:S\to S[x]$ as $\iota(s)=s$, you therefore obtain an injective ring homomorphism. This should be straightforward for you to verify: Arithmetic on constant polynomials is quite literally the same as arithmetic on elements of $S$.
Now in what you quote, they define $\phi:=\iota \circ \varphi$.
Edit: I realize you asked for an example, but I am afraid I can't really come up with better advice than to maybe think of $S$ as just the real numbers or some other field you are comfortable with, and then realize that constant polynomials are quite literally the same as that field, so you can view the field as being a subset (and even a subring) of all polynomials.