For example is a fixed usage, and it is a stunned translation of the Latin exempli gratia. This is also abbreviated as e. for exampleg.Reasons.
The Latin exempli is a genitive, roughly equivalent to the adjective "of example"; Gratia is the main case, which is equivalent to the noun "reason, cause". exempli gratia means "for example".
The Latin word gratia is also a case, which is equivalent to a self-contained preposition, which means for the sake. The English custom is that the preposition precedes the noun, i.e. exempli gratia is stunned to correspond to for the sake of example, which is further abbreviated for example.
Because for example is an abbreviation for Latin, so
1) The meaning cannot be taken literally, but can only be read as the original Latin word for "for example", i.e. by way of illustration or as an example instance;
2) Although example is a highly countable noun, an indefinite article cannot be added to for example;
3) for example is an adverbial that modifies a sentence (does not modify a word);
4) For example does not have the meaning of "for"; for an example means "for an example", not "as an example".
In addition, there are phrases pour exemple, par exemple, which are literally translated for example.
Example sentence 1】Many countries, for example mexico and Japan, h**e a lot of earthquakes(Many countries, such as Mexico and Japan, have a lot of them.) Longman Dictionary of Contemporary English].
Example sentence 2】many of the things he loved as a child - for example candy and cartoons - still give him pleasure(Many of the things he enjoyed as a kid — like candy and cartoons — still bring him joy.) [Cambridge Dictionary of Senior Scholars].