A rate-and-term refinance swaps your loan for one with a better rate or different length. A cash-out refinance borrows more than you owe and pays you the difference.
Refinancing isn't free — you pay closing costs again. It makes sense when you'll keep the new loan past the break-even point and the total interest over that time is lower, not just the monthly payment.