Ab-initio theory of magnetic ordering : electronic origin of pair- and multi- spin interactions