There is a very simple way to avoid plagiarism: ALWAYS credit the sources of the facts, ideas, and words you use in your writing.
In fact, there is an exception. You are not required to cite a source for "common knowledge" -- those things everyone knows.
However, if you are in doubt about whether something you saw in a source is common knowledge, CITE IT! "Better safe than sorry" is the rule to follow.
The resource pages included below include some very useful tools that will help you cite any source you use and, therefore, avoid plagiarism.