When you refinance, you take out a brand-new mortgage that pays off your existing one. The new loan typically has a different interest rate, a different term, or both. Your monthly payment changes, your remaining loan balance resets, and you start the amortization clock over.
Refinancing isn't free — there are closing costs (just like when you bought the home). The math only works when the savings outweigh those costs before you sell or refinance again.