As somebody who has studied a lot of Latin, this one annoys me more than it should, and seems extremely avoidable. You see the two confused far too often! Both are direct abbreviations of short Latin phrases, and both are used to clarify a preceding statement – one by giving examples, the other by explaining something further. But which is which?
e.g. stands for exempli gratia (literally “for the sake of example”), and should be used when giving an example or several examples of something.
For example: “I love eating fruit – e.g. apples, oranges, and mangoes.”
i.e. stands for id est (literally “that is”), and is used in the sense of “in other words”, or “which means” – expanding on a previous statement.
For example: “The responsibility falls only to the President of the United States, i.e. Barack Obama.”