Use of the semicolon is hard to understand because, unlike commas and periods, the semicolon is not necessary to make meaning; we could easily do without it with no serious consequence to the language. Semicolons are used to increase readability, so we need to look at their use in the wider context of an entire piece of writing.
Following grammar books, the semicolon is used to separate two independent clauses, which produces a comma-splice if done with a comma and, if done with a period, produces two sentences. Alternatively, one could always use a comma + "and" for the same effect.
Normally, two independent clauses joined with a semicolon should be close in meaning. Here is an example from Dr Martin Luther King:
Is not segregation an existential expression of man's tragic separation, his awful estrangement, his terrible sinfulness? Thus it is that I can urge men to obey the 1954 decision of the Supreme Court, for it is morally right; and I can urge them to disobey segregation ordinances, for they are morally wrong. -- M. L. King, Letter from Birmingham Jail. (cited by Petit, 2003).
If you are approaching this from the point of view of what is correct and incorrect, you will become confused. It is usually a matter of style and many writers never use semicolons at all.
Here are a couple of good resources on the topic of semicolons, if you'd like to find out more:
Dawkins, John (1995). Teaching punctuation as a rhetorical tool. College Composition and Communication, 46(4). 533-548
Petit, A. (2003). The Stylish Semicolon: Teaching Punctuation as Rhetorical Choice. The English Journal, 92(3), 66-72.