Both of these come from the Latin, and both are useful ways to say something in a short space (and one word, if you’re worried about word-counts!) although they tend to make the text look messy if they’re used too often, in my opinion.
First of all, e.g. – this abbreviation stands for “for example”, is used to introduce an example of whatever you’ve just been discussing, and comes from the Latin “exempli gratia”. Bonus fact: don’t put it in italics and put a comma before but not after. “There are many power tools that can be used, e.g. drills, sanders and grinders.”
And i.e. means “that is” and again comes from the Latin; “id est”. You use it if you want to explain what you’ve just said (rather than exemplify it). Another bonus fact – just like e.g., don’t put it in italics and put a comma before, but not after. “This project requires the use of power tools, i.e. those that require electricity to operate them.”
I would construct a sentence here containing both, but I don’t think it would look pretty and it certainly wouldn’t be recommended practice …
You can find more troublesome pairs here.