If the sentence is already a run-on, you can fix it by either separating the two independent clauses and/or adding proper punctuation. If the sentence is already a fragment, you can fix it by attaching it to the main clause or adding the missing parts to the sentence such as a subject, etc.
You can avoid run-ons by making sure the sentence does not have two independent clauses without proper punctuation. You can avoid fragments by making sure the sentence is not separated from a main clause and the sentence has all necessary parts.
Fragments are incomplete sentences. Usually, fragments are pieces of sentences that have been separated by a main sentence. One of the easiest ways to correct them is to remove the period between the fragment and the main sentence. Other kinds of punctuation may be needed for the newly combined sentence for it to be accurate.
A run-on is a sentence in which two or more independent clauses or separate sentences are joined without an appropriate conjunction or mark of punctuation. It is also known as "fused sentences" because it's as if you took two singular sentences and smooshed them together.