How does it happen? We have an idea for an essay and start writing. Before you can say Grammar Teacher, something triggers a memory or another thought and you add it to what you've already written. Three more paragraphs and you think of something else that is only mildly related, but you like it and add that, too. Before you know it, your essay is weaving across clearly marked lines and it can even turn into two separate essays.
In high school, English teachers preached about the topic sentence. It's one sentence at the beginning, or close to the beginning, of your essay that defines the entire piece. It's almost like watching a movie preview. It tells the reader what he/she is going to find in the wh Everything that follows should pertain in some way to it.
If you suddenly decide to add a personal anecdote, or a piece of your past, that's fine. But it should be pertinent to the subject. And keep it brief. If you talk about Aunt Sally, the reader doesn't need to know how Aunt Sally is related to your family, or where she grew up, or what kind of pie she makes--unless those things are important to the point you're making.
That topic sentence you wrote is your guiding light. Keep it shining on one straight path. Your probability of having the essay published is much greater if you do so.