The length of time that you expect to keep the mortgage helps you determine whether it is worthwhile to pay points up front to reduce your interest rate. Unlike points paid on your original mortgage, points paid to refinance may not be fully deductible on your income taxes in the year they are paid.
If there are only a few years left on your current loan, it's no use refinancing with a long term loan. You may need extra cash but with a long term loan, you'll end up paying more for the entire loan term.
Changing the term of your mortgage can help in several ways. First, if you were to refinance your current mortgage from 30 years to 15 years, you will accelerate the rate at which you pay towards principle each month meaning your house will be paid off quicker. Also, you will save an unbelievable amount of money in terms of interest because you would likely be taking 10 to 15 years off the life of your loan. Second, you can also refinance a 15 year mortgage to a 30 year mortgage. It seems like it might not make sense to do this, but if you have an immediate need to free up monthly cash-flow and you don't want to take out a home equity loan, this can work out to your benefit. When you take a 15 year loan and refinance it to 30 years you will have the same balance only the payments can be hundreds of dollars less than the 15 year loan. The only draw back to this is you will pay more in interest over the live of the loan.
Refinacing your mortgage can allow you to take cash out of the equity which you have built in your home. You can pay off your higher interest debts and pay all of your debts at a lower interest rate. This will allow you to save money on a monthly basis and achieve your financial security.