The compiler recognizes the array as static / constant and therefore most of it is optimized away and multiple pointers points to the same address in memory. These addresses are compared, not the strings located there.
void setup()
{
const char* str1 = "foo";
const char* str2 = "foo";
const char* str3 = "foobar";
Serial.begin(9600);
Serial.print("str1 = ");
Serial.println((int)str1);
Serial.print("str2 = ");
Serial.println((int)str2);
Serial.print("str3 = ");
Serial.println((int)str3);
if (str1 == str2) Serial.println("str1 and str2 are equal"); //Will print
if (str1 == str3) Serial.println("str1 and str3 are equal"); //Will not print
}
Code is untested but I'm sure that str1 and str2 prints the same addresses, which are compared in the code.