Let $K$ be a field and $G$ be a finite group, and denote by $K[G]$ its group ring, then Maschke's theorem is:
Suppose $\mbox{char}(K)$ does not divide $|G|$. Let $V$ be a $K[G]$-module. If $W \subseteq V$ is a $K[G]$-submodule, then there is a submodule $W' \subseteq V$ such that: $$ W + W' = V, \quad W \cap W' = 0. $$ Proof: In the proof by linear algebra, we can choose a linear subspace (where $V$ is considered as a $K$-vector space) $X$ of $V$ such that $V = W + X, W\cap X = 0$. Then we take the projection $\pi : V \to W$, which in general is not a $K[G]$-module homomorphism, so we modify it to $$ q(v) := \frac{1}{|G|} \sum_{g\in G} g(\pi(g^{-1}v)) $$ and this gives an $K[G]$-module homomorphism. Then $W' = \mbox{ker}(q)$ (I omit the verficational part of the proof). $\square$
This proof I found in many sources (for example here, here and here, or also in S. Lang's book Algebra) . But what I do not understand is the multiplication by $1/|G| \in \mathbb Q$. In general, the sum $$ \sum_{g\in G} g(\pi(g^{-1}v)) \in W \subseteq V $$ as it is a $K[G]$-submodule, but how could we multiply an element from $W$ (or $V$) by a rational number $1/|G|$? That does not make much sense to me...
The reason for rescaling is so that $q(q(v))=q(v)$ (i.e. $q$ is a projection operator). The number $1/|G|$ is not a rational number. Instead $1/|G|=|G|^{-1}\in K$, which exists since by assumption $0\neq |G|=|G|\cdot 1_K\in K$.