Your payments are allocated first to any fees assessed on your account (e.g. for late payment, returned ACH, etc.), then interest, and finally to the principal balance. Interest accrues daily on the remaining principal balance and does not compound on any unpaid interest that has accrued.
At the beginning of the loan, a larger share of the payment is applied to interest because most of the principal balance has not been repaid yet, so a larger dollar amount of interest will accrue. As you pay down the principal, a smaller amount of interest will accrue each month because the principal balance will be less. This will allow a larger share of the monthly payment to repay principal over time.
Because interest accrues daily, the amount of interest owed for a specific payment will vary depending on how many days have passed since the last payment. This means if you make your monthly payment a few days early, fewer days of interest will have accrued, and a larger share of your payment will go towards paying down principal than if you had waited the full month.