1) most of the time if two users try to access the file at the same time nothing bad will happen. but with no flocking and heavy access there is a real chance for file corruption. the problem is the order the file system calls are made. for example if a file is truncated by one process so data can be added to the start of the file and if another process just happens to read the file after the truncate and before the fwrite then bad things happen (file has now been erased and only contains some of the new data). but for this to occur the server (running millions of instructions at a time) would have to choose to stop the first process in midstream after the truncate, run another process accessing the same file, and try to read/write the file. if the first process is trying to add data a similiar problem can occur, but most likely the data added by the first process would be lost. either way, if you can't count on the file contents to be consistent, you might as well use paper and pencil.
2) the magic numbers map to constants defined by the OS. according to http://www.php.net/manual/en/function.flock.php:
To acquire a shared lock (reader), set operation to LOCK_SH (set to 1 prior to PHP 4.0.1).
To acquire an exclusive lock (writer), set operation to LOCK_EX (set to 2 prior to PHP 4.0.1).
To release a lock (shared or exclusive), set operation to LOCK_UN (set to 3 prior to PHP 4.0.1).
If you don't want flock() to block while locking, add LOCK_NB (4 prior to PHP 4.0.1) to operation.
3) close the file pointer or call flock with the magic number of 3 (LOCK_UN)
4) here is a decent link that explains how flock is handled by the OS:
http://www.tcp.com/~mink/CLAM/week8.html
scroll down to where it says "How can I have my CGI process lock a file?"
even though the examples are in perl the basic idea is the same.