Most programs which you usually run in a terminal will terminate when the terminal they are connected to is hung up. When this happens, Linux sends the process HUP signal (HUP = HangUP). There are a few ways to prevent this.
Some programs simply ignore this signal, and in that way can continue without impediment. You can do this in your own scripts by trapping the signal.
A 'traditional' unix way to do it is to use the nohup command. This sends any program output to a file called nohup.out, and prevent the HUP signal from reaching a program. You have to invoke the program with nohup, e.g.
You can then press control-Z to suspend the process, enter "bg" to background it, and log out. The program will continue. You cannot re-attach to the process, but it works for many tasks, and has the advantage of being installed pretty much everywhere.
Screen is the ultimate solution for this, allowing you to re-connect to sessions after disconnecting, and even letting multiple views on the same session. The only problem with screen is that it is not as commonly installed (especially on more traditional unixes), and it's a bit bigger and more resource hungry than nohup. It's not big, but on embedded or other very light weight systems it might be an issue.