The header function simply sends an http header to the browser. It must be called before any output is sent to the browser. (In this case you wouldn't be outputing anything else to the page, at least not in this script.) The exit function just exits the script, of course.
When you send a location header to the browser you are telling the browser to redirect to the new url. So if you wanted to redirect to page2.php, you would do this
header('Location: page2.php');
exit();
The example I gave before was to redirect the user back to the same page. I do this when updating a cart, or something like that, where I want the user to remain on the page, but I don't want refreshing the page to resubmit a form.