This is the "bottoms up" description of the ideal: it tries to describe the elements of the ideal generated by $S$ explicitly. This in contrast to the definition you give at the end, which is the "top down" description of the ideal. (See this previous answer for general comments about the top down vs bottoms up approaches.
So... what is an ideal? It is a subset which is (i) a subgroup of the additive structure; and (ii) closed under multiplication on the left by elements of the ring; and (iii) closed under multiplication on the right by elements of the ring.
So if we start with a subset $S$, how can we "build up" the ideal generated by $S$?
First, we need to make sure it is a subgroup; this is accomplished by considering the subset $\mathbb{Z}S$, which is the subgroup of $(R,+)$ generated by $S$.
Then we need to make sure the product of any element of $R$ by an element of $S$ is in the set; moreover, we need sums of these products. This is accomplished with $RS$, which is defined to be the collection of all (finite) sums of elements of the form $rs$ with $r\in R$ and $s\in S$.
Then we need to make sure the product of an element of $S$ by an element of $R$ is in the set, and the sums of these products. This is the $SR$ summand, which consists of all sums of elements of the form $sr$ with $s\in S$ and $r\in R$.
Then we need all products where we multiply on both left and right: so all elements of the form $r_1sr_2$ with $r_1,r_2\in R$ and $s\in S$ (we are not assuming that $R$ has a unity, so these elements need not be among those we have in items 2 or 3), and sums therefore; this is the summand $RSR$.
Then we need to make sure we can add/subtract all such elements, so we consider the sum of the sets we have that we know must be included in $(S)$; that is $\mathbb{Z}S + RS + SR+ RSR$.
Now normally we would need to keep going: take the subgroup generated by these elements, then products on the left, products on the right, and products on both sides. But it turns out that the collection we have in 5 is already a subgroup, already satifies that if $x\in \mathbb{Z}S+RS+SR+RSR$ and $r\in R$ then $rx$ and $xr$ are both in $\mathbb{Z}S+RS+SR+RSR$. And hence this is already an ideal. Thus, as all these elements must be in any ideal that contains $S$, and it is in fact an ideal, it follows that this is the smallest ideal that contains $S$, hence it equals $(S)$.