If $\mathbb{K}$ is algebraically closed (e.g. $\mathbb{K}=\mathbb{C}$), then the Artin-Wedderburn theorem says that the group algebra $\mathbb{K}G$ splits as a direct sum of matrix algebras over $\mathbb{K}$: $ \mathbb{K}G \cong \bigoplus_i M_{n_i}(\mathbb{K}). $ Each of the matrix algebras, the so-called blocks, consists of $n_i$ copies of isomorphic irreducible representations of dimension $n_i$, corresponding to sub-algebras consisting of matrices that are 0 outside a given column (my modules are left modules). For $i\neq j$, the associated irreducible representations are mutually non-isomorphic, since they are annihilated by different blocks. That is one way of deriving the familiar formula $|G|=\sum_i n_i^2$.
But when $\mathbb{K}$ is not algebraically closed, this statement needs to be modified. Now, Artin-Wedderburn says that the group algebra $\mathbb{K}G$ is isomorphic to a direct sum of matrix algebras over division algebras: $ \mathbb{K}G \cong \bigoplus_i M_{n_i}(D_i), $ where each $D_i$ is a division algebra over $\mathbb{K}$, and each block consists of $n_i$ isomorphic copies of irreducible representations, again corresponding to sub-algebras of matrices that are 0 outside a given column. But now, each of these is $n_i$-dimensional over $D_i$, which in turn has dimension $d_i$ over $\mathbb{K}$. Thus, each irreducible representation has dimension $d_in_i$ over $\mathbb{K}$. Hence the formula $ \dim_{\mathbb{K}} \mathbb{K}G = \dim_{\mathbb{K}}\left(\bigoplus_i M_{n_i}(D_i)\right)= \sum_i d_in_i^2. $
This will become clearer if you consider a specific example. Take $G=Q_8$, the quaternion group of order 8. Let's take a non-algebraically closed field of characteristic 0, e.g. $\mathbb{R}$. Recall that the only division algebras over $\mathbb{R}$ are $\mathbb{R}$, $\mathbb{C}$, and $\mathbb{H}$, the quaternion algebra. It turns out that $ \mathbb{R}Q_8 \cong \mathbb{R}\oplus \mathbb{R}\oplus \mathbb{R}\oplus \mathbb{R}\oplus\mathbb{H}, $ whence $8 = 1+1+1+1+4$. Note that the block corresponding to $\mathbb{H}$ becomes $M_2(\mathbb{C})$ over $\mathbb{C}$, meaning that the irreducible 4-dimensional representation over $\mathbb{R}$ splits as a direct sum of two 2-dimensional irreducible representations over $\mathbb{C}$.