It depends. If you refinance with a new lender, you can deduct the amount of unamortized points on the mortgage in full, in the year that the mortgage is paid off. If you refinance with the same lender, the mortgage isn't quite being "paid off" (and then transferred to a new lender). In that case, you cannot deduct the unamortized points because they remain with the original lender and simply transfer to the new loan.
If you financed with a new lender, you can deduct the remaining points on the old loan. The best way to enter them is probably to make an extra 1098 entry for the old lender that only lists the remaining points.
If you refinanced with the same lender, take the remaining old points plus the new points and use that as your figure to spread points out over the new loan.