Refinancing can save you money on your mortgage or can help you to get into a more secure form of mortgage loan. However, refinancing is not always a good idea.

If you are refinancing to get into a fixed rate mortgage from a variable rate or balloon mortgage, or if you are refinancing to get cash out, it is usually worth it to refinance so that you can have more stable, fixed payments or so you can get access to the cash you need.
If, however, you are refinancing in order to get a lower interest rate, then you will need to calculate how much money you will save on the refinance in order to determine when it's worth it to refinance your loan.
The reason this calculation is important is because refinancing is not free. You need to pay closing costs, which typically include an application fee, loan origination fees or lender's costs, a title search, settlement fees to settle the loan, title insurance and document preparation fees. The average amount of these closing costs can be several hundred dollars.
You will thus need to calculate how much money you are going to save on interest through the refinance, and then compare that to the amount of the closing costs to see how long it will take you to make the closing costs back.
There are numerous online calculators that allow you to do this calculation precisely, including one at Mortgage 101.com. You can also get a rough estimate of the amount you will save on interest by multiplying your current interest rate times the principal and by multiplying the new interest rate after refinance times the principal and comparing the numbers. This won't be exact, since your principal is going down every month and so the amount you pay in interest fluctuates. However, it can give you a good general idea.
For example, assume you owe $100,000 on your mortgage and that your current interest rate is 6 percent. This means you pay around $6000 in interest annually. If you can refinance into a 5 percent rate, you will pay around $5000 in interest annually. Thus, you save $1000 per year. If your closing costs were $500, it would take you six months to make up the amount you paid in closing costs. Thus, if you were going to stay in the house for longer than six months, it would be worthwhile to refinance because you would make up your closing costs and then save money on all of your remaining payments for the rest of the time you live in the house.
The dictionary defines refinancing as:
to finance again; specif., to provide or obtain a new loan or more capital for
This means that when you refinance, you take out a new mortgage to pay off your old mortgage. There are several possible reasons you may want to do this.
The most common reason people refinance is to lower their mortgage interest rate. Lowering your mortgage interest rate can save you money on your monthly payments. Your monthly payments are determined by how much you borrow, the length of your mortgage, and how much you pay in interest. When you have a 30 year fixed rate mortgage, for example, your payments are calculated so you will pay off your mortgage in 30 years. Thus, each year you must pay enough money to cover the interest you are accruing throughout the course of the year, plus some of the principal (the original amount you borrowed). If you reduce the interest rate, you'll owe less interest each month, so your payments will be smaller.
However, people also refinance in order to switch from an adjustable rate mortgage, or a balloon mortgage, which are somewhat risky types of financing that people use to buy homes for lower initial payments. An adjustable rate mortgage is a mortgage in which your interest rate fluctuates according to a financial index (such as the LIBOR index). A balloon mortgage is a mortgage where you pay a low interest rate for a period of time, and then the entire balance of your mortgage comes due and you need to pay it off, often by refinancing into a new loan.
Finally, some people refinance to get cash or equity out of a home. Equity refers to the value of the house that belongs to you, not the bank. So, for example, if you owe $100,000 and your house is worth $150,000, you have $50,000 in equity. You may want to get this $50,000 out of your house so you can use the money for some other purpose.