QUESTION: I have trouble trying to figure out when to begin and end paragraphs and when to have dialogue included in the paragraph and when to have it stand on its own as an independent paragraph.
Unlike nonfiction, there are no hard and fast rules for paragraphing in fiction. Much of this is the writer's choice which is informed by experience as well as their need to emphasize certain things or break between actions.
And, surprisingly, some choices are as much visual as mental. Most readers, these days, don't like long paragraphs so many writers paragraph more frequently than did past writers. Visual space makes the page more attractive to the reader.
Here are some good rules of thumb, though.
When you start with narrative followed by dialogue, the narrative should be about the person who will speak.
Adam studied the book's page then glanced back up at his friend. "Pete, we have a problem here."
If the narrative is about Pete, Adam's line would be in a new paragraph.
Pete watched his friend anxiously as he read the rule book.
"We have a problem here,” Adam said.
If you have a long bit of narrative, it's usually a good stylistic choice to paragraph before the character's lines. This breaks up the lines visually, and it also emphasizes the dialogue.
When you are writing a long speech by a character, you paragraph to emphasize subject, changes in subject, and the rhythm of the scene.
If you aren't sure about any of the above, read the dialogue aloud as the character would speak it. Notice when you have natural pauses. That's a good place for a paragraph break.
Dialogue shouldn't be too long, though. Break it up with a bit of narrative.
Adam shook his head in disgust and continued,
Or have other characters react or comment.
"I can't believe Pete said that. It doesn't sound like him."
For straight narrative with no dialogue, you should paragraph when the action shifts to another character.
Pete tripped but caught himself before falling flat on his face.
Behind him, the sound of Adam's running feet moved toward him, then his friend stopped at his side.