e.g. and i.e. are both abbreviations for Latin phrases.
i.e. is an abbreviation for id est, meaning “that is.” It introduces an alternative or additional way of describing something. You can think of i.e. as meaning “in other words . . .”:
The greatest mystery in science is human consciousness, i.e., awareness.
Pamela was controversial; i.e., she got people talking.
e.g. is an abbreviation for exempli gratia, which means for example. Examples should be more specific than whatever they clarify:
Physicists have discovered many fundamental particles, e.g., electrons, photons, and quarks.
It is easy to see how these two phrases seem similar, but they are not interchangeable. Use i.e. for clarification using alternative descriptions, and use e.g. for clarification by examples.