The two loans are both standard amortization schedules
Both the current loan and the replacement are run through the same amortization calculation as the site’s other loan pages: fixed monthly payment, interest charged each month on the balance, principal shrinking against it. The current loan keeps its existing rate and remaining term; the replacement restarts a fresh term at the new rate.
The monthly saving is the new payment minus the current payment. The lifetime saving compares the total interest of the current schedule with the total interest of the new one - plus the fees, which are as much a part of the refinance price as the rate is.