This question also has an answer here (in German):
Wieso muss »es« in diesem Satz stehen?
Ich mag es, am Strand zu liegen
The way I see, this phrase could have the same meaning as 'Ich mag am Strand zu liegen', but this apparently isn't the case.
German Language Stack Exchange is a bilingual question and answer site for speakers of all levels who want to share and increase their knowledge of the German language. It's 100% free, no registration required.Sign up to join this community
It is an argument of the verb
mag, which functions as a direct object and pronoun for "am Strand liegen".
Perhaps a good analogy to English would be this sentence:
I like it when I can [just] lie on the beach [and do nothing].
Sometimes this word "it" disappears into the mysterious world of consciousness :) (see https://en.wikipedia.org/wiki/Ellipsis_(linguistics) because it is redundant or unique such that "it" can only function in one way. In other words, it can be skipped by the mind (perhaps to save time in speech?)