What does the F() do exactly?

or create a sketch with duplicates
then make a one character change
if the sketch stays the same size you had duplicates
if it increases by the length of the string - then it was being optimised

void setup(void)
{
  Serial.begin(19200);
}
void loop(void)
{
  Serial.println(F("abcdefg"));
  Serial.println(F("abcdefg"));
}

and

void setup(void)
{
  Serial.begin(19200);
}
void loop(void)
{
  Serial.println(F("abcdefg"));
  Serial.println(F("xbcdefg"));
}

both compiled to 2040 bytes
so it looks like no optimisation