"die" is a php function. It prints the string passed to it and stops the processing of your script.
The "or" part is a little less clear; suppose you have this expression:
if ($x == 1 or $y == 2) {
The php interpreter knows that if $x==1 it doesn't have to check whether $y==2, the "or" expression is true no matter what value $y has. So to save time it stops interpreting the expression as soon as it knows the result. But if $x is not equal to 1, it will have to check whether $y equals 2.
Now consider this:
$result = mysql_query($sql) or die ("It failed");
Since the "die" is to the right of the "or", the interpreter will not call the "die" function if the mysql_query function returned a non-zero value, same as when it did not check the value of $y above; the only time the "die" function would be called is if the mysql_query function fails.