Explanation of fefinition of cartesian product for modules, relation with simple cartesian procuts from cartesian plane Consider an arbitrarily given indexed family
$$F = \{X_i \ | \ i\in M\}$$
of modules $X_i$ over $R$ and denote by
$$P = \Pi_{i\in M}X_i$$
the cartesian product of the family $F$. By definition, an element of $P$ is a function
$$f:M\to U$$
from the set $M$ of indices into the union $U$ ofthe sets $X_i$ such that $f(i)\in X_i$ holds for every $i\in M$
I can understand that an element of the cartesian product is a function, and this function is from a set of indexes to $X_i$. However, when I think of simple cartesian products like $\mathbb{R}\times\mathbb{R}$ not for modules, but simply for sets, the elements are not functions, they're just sets (ordered sets). I'm trying to relate the two concepts, I don't know if they're supposed to be analogous but if not, I'd like examples of cartesian products, because my books gives none, it just uses as a basic definition for other theorems.
 A: We usually don't write $\mathbb R\times\mathbb R$, but $\mathbb R^2$.  In fact, often the notation $B^A$ is used for the set of functions $A \to B$.  If we think of $2$ as a two element set, then we have a (canonical) bijection $\mathbb R \times\mathbb R \cong \mathbb R^2$ just as high school algebra would suggest.  Indeed, $B^A \cong \prod_{a\in A} B$ in general.  In type theory $\prod_{i:I}X_i$ is usually taken as a primitive and functions are defined by the case where $X_i$ is constant with respect to $i$, as above with $B^A$.  Writing out these bijections in the finite case, e.g. $B^2 \cong B\times B$, may be an interesting exercise.
In the much broader context of category theory, something like the high school algebra "laws of exponents" holds for any symmetric monoidally closed category (which includes cartesian closed categories) like $R$-Mod, the category of $R$-modules.  To be clear, the product of modules you mention is not part of this symmetric monoidally closed structure. There's a different structure called powers and copowers that corresponds to the case where you are taking the product of the same module, i.e. $[M,X]\equiv\prod_{i\in M}X$ (note, no $i$ subscript and here $M$ is a set and $X$ is a module) that also satisfies rules like the "laws of exponents". We have $[2,X]\cong X\times X$, for example. (This is trivially true given how I defined $[M,X]$, but it's also provable from the universal property of $[M,X]$.) In the case of the category of sets, all these things coincide.
