The loan $S=Ma_{\overline{n}|r}$ where $r=i/12$ in $n$ total months.
If $S$ and $M$ are known we can easily find tne number of months to repay the loan
$$
S=Ma_{\overline{n}|r}=M\frac{1-(1+r)^{-n}}{r}\quad\Longrightarrow\; n=\frac{\log\left(\frac{M}{M-rS}\right)}{\log(1+r)}
$$
and the number of years is $m=n/12$.
At any time $k$ (month) the interest payment is
$$
I_k=rMa_{\overline{n-k+1}|r}=M\left(1-v^{n-k+1} \right)
$$
with $v=\frac{1}{1+r}$ and the principal payment is
$$
P_k=M v^{n-k+1}
$$
so that $M=P_k+I_k$ and the oustanding balance is
$$
B_k=Ma_{\overline{n-k}|r}
$$
If the outstanding balance at month $k-1$ is known, i.e. what is left to be paid back, and the payment $M$, we can find the interest payed at month $k$ as
$$
I_k=rB_{k-1}
$$
and $P_k=M-I_k$.
The monthly repayment of the loan is equivalent to the yearly repayment of the loan with effective annual interest $$j=\left(1+\frac{i}{12}\right)^{12}-1=(1+r)^{12}-1$$
for $m=n/12$ years:
$$
S=Ma_{\overline{n}|r}=M\frac{1-\frac{1}{(1+r)^n}}{r}=M\frac{1-\frac{1}{(1+j)^m}}{r}=M\cdot\frac{j}{r}\cdot \frac{1-\frac{1}{(1+j)^m}}{j}=A a_{\overline{m}|j}
$$
observing that $(1+r)^n=(1+r)^{12\times\frac{n}{12}}=(1+j)^m$ and the yearly installment is $A=M\times\frac{j}{r}$. Observe that $A$ is the future vale at the end of the year of 12 installment of value $M$ at monthly interest $r$:
$$
A=M\times\frac{j}{r}=M\times\frac{(1+r)^{12}-1}{r}=M\cdot s_{\overline{12}|r}
$$
and expressing $r=i/12$ we have that
$$
A=M\times\frac{j}{r}=M\times\frac{j}{i/12}=12M\times\frac{j}{i}
$$
that is $A>12M$: the installment that we have to pay annually is greater than the sum of the monthly installments in one year, because the annual effective interest $j$ is greater than the monthly interest $i$:
$$
\frac{j}{i}=\frac{(1+i/12)^{12}-1}{i}>1\quad \text{for } i>0
$$
At any time $t$ (year) the interest payment is
$$
I_t=jAa_{\overline{m-t+1}|j}=A\left(1-\nu^{m-t+1} \right)
$$
with $\nu=\frac{1}{1+j}$ and the principal payment is
$$
P_t=A \nu^{m-t+1}
$$
so that $A =P_t+I_t$ and the oustanding balance is
$$
B_t=Aa_{\overline{m-t}|j}
$$
If the outstanding balance at year $t-1$ is known, i.e. what is left to be paid back, and the payment $A=Mj/r$ we can find the interest payed at year $t$ as
$$
I_t=jB_{t-1}
$$
and $P_t=A-I_t$.