The way most installment loans work is that they have a fixed interest rate and a fixed monthly payment. As you pay down the loan, the amount of each payment that goes to interest declines.
For example, say you borrow $1000 at 12% interest. I say 12% because that works out neatly to 1% per month. The payments are $100 per month.
So the first month, the borrower owes 1% of $1000 = $10 interest. So he pays $100. $10 goes to interest and $90 goes to principal.
The second month he only owes $910, because he's now paid off $90. 1% of $910 is $9.10. So he pays $100. $9.10 goes to interest and the remaining $90.90 goes to principal.
The third month the principal is now $910.00 - $90.90 = $819.10. 1% of that is $8.19 (and a fraction that gets rounded off). So off his $100 payment, $8.19 goes to interest and $91.81 goes to principal.
Usually when you get a loan, they start with the amount of the loan, the interest rate, and the repayment time and calculate the payment amount, rather than starting with the payment amount and calculating how long it will take to pay it off.
The formula is a bit complicated. If:
P is the principal
t is the number of months to repay
r is the monthly interest rate (i.e. annual rate divided by 12)
then the amount of the monthly payment is:
m=P x ((r+1)^t x r) / ((r+1)^t - 1)
For example, suppose the principal is $1000, the monthly interest is 1% (12% per year), and the repayment time is 120 months (10 years). Then the monthly payment is:
m=$1000 x (1.01^120 x .01) / (1.01^120 - 1)
=$1000 x (3.300 x .01) / (3.300 -1)
=$1000 x (.0330 / 2.300)
=$1000 x .01435
See how simple?