These two cause more confusion than they should. I suspect that some of that confusion is because they are used to gussy up writing without a lot of thinking. Each is pretty straightforward, though:
“i.e.” stands for “id est.” It means “that is,” and means “in other words.” “put another way.” It is used for re-phrasing the previous sentence, or giving a small bit of explication.
“e.g.” stands for “exempli gratia.” It means “for example” and is used for giving, wait for it, examples of the thing just described.
That’s it. Another post with a short quiz at the end is here.
The Chicago Manual of Style, 16th ed. (2010), 5.220 includes a rule that you should always include a comma after either “i.e.” or “e.g.” Bryan Garner, in The Elements of Legal Style, 2d ed (2002), 113 takes the softer position that they should “generally” be set off by commas. I can’t say I have a strong view on this. Or think I’m likely to develop one. I think I’d be more likely to worry about whether they should be italicized. For someone who does care about this more than me, and even made a chart comparing various style guides, take a look at this. No seriously, go look at it.