Let $X=\{x_1,\cdots,x_n\}$ be a finite set and let $R$ be a ring. We construct an $R$-module $M$ in the following way: an element $a$ in $M$ is a "formal sum" $a=\sum_ir_ix_i$ where $r_i $ are in $R$. The addition and external multiplication are clearly defined and they are induced from the addition and the internal multiplication of the ring $R$ using the rules that $r_ix_i+s_ix_i=(r_i+s_i)x_i$ and $r_i(s_ix_i)=(r_is_i)x_i$.
What I don't understand is whether a formal sum is well defined mathematical object or just an abuse of notation. and the other thing is that would it be better to write a formal sum as an unordered set of $n$ couples $(r_i,x_i)\in R\times X$. My last question is about the case the ring $R=\mathbb Z$, in this case the sum is not formal because $r_ix_i$ has a meaning which is the element $x_i$ considered $r_i$ times and in this case $M$ is the free abelian group on the set $ X$. What do we call $M$ if $R$ is not $\mathbb Z$. Thank you for clearing these ideas out !!
The construction you describe is that of a free $R$-module. It can be made precise.
Let $X$ be any set (it need not be finite, but then the following finiteness condition is superflous):
Let the elements of $M$ be functions $f : X \to R$ (families $(f_x)_{x\in X}$) , such that $\{f_x\neq 0 : x\in X\}$ is finite. Then define the module structure in the obvious fashion. Finally you can prove that a "copy" $X'$ of $X$ is a basis for $M$ and that $f = \sum_{x\in X'} f_x\cdot x$. This is well-defined because of the finiteness condition above.