Consider the following matrix.
From the matrix, it's obvious that the sum of the black part ($S_1$) and the sum of the red part ($S_2$) are
$$S_1 := {\sum_{i=1}^{5}}(6-i)a_i, \qquad S_2:= {\sum_{i=1}^{5}}(i-1)a_i$$
respectively. Suppose that I know $M := {\sum_{i=1}^{5}}a_i$. Can i use the structure of the given matrix to find the values of $S_1$ and $S_2$ in terms of $M$ only?
From the matrix i can tell that $S_1+S_2=5M$. With another solution we can write $S_1$ and $S_2$ in terms of $M$ only. So are there any rules or theory that can help doing that? and could it work for any dimension $N$ of the given matrix? Please someone help me guys. Thank you guys so much and thanks for such great platform!

Once you have defined $S_1$, $S_2$ and $M$, you can forget the fact that you have a matrix. It will not give you any more structure.
Now, Rodrigo is right in that your system of equations are underdetermined, i.e. you do not have enough information to guarantee a unique solution. The degrees of freedom may not be $3$, however, since you are not after all the $a_i$'s, just $S_1$ and $S_2$. In any case, let me give you an example to show that you cannot determine $S_1$ and $S_2$ from $M$:
Take first $a_1=a_2=\dots=a_5=1$. Then $M=5$, $S_1=15$ and $S_2=10$. However, if we take $a_1=\dots=a_4 = 0$ and $a_5=5$, we still get $M=5$, but $S_1=5$ and $S_2=20$. As you can see, both cases satisfy $S_1+S_2=5M$, but the $S_1$ and $S_2$ can vary anyway even for a fixed $M$.