2 ways that I know of. I only knew of 1 most of my life and when someone described the second I thought it couldn't possibly work but it does. Both of the following are what you do when you have done the bind off to the point where you have only one stitch loop on the needle.
1:Cut the yarn leaving a tail of at least about 6". Take the last loop off the needle and pull the tail through that loop. A crochet hook will help with that or a tapestry needle, or just enlarge the loop and then stick the tail through it and pull on the tail a bit to snug the loop back to size.
2: Cut the yarn but don't take the needle out. Now lift the needle and keep lifting it (use your other hand to hold on to the piece of knitting right below the loop) until the tail has pulled free.