In InDesign, the Keep Options determine if a paragraph is allowed to break its lines onto a new page. The default is "do nothing at all":
– that is, text may break anywhere. You can manually fix text by inserting page breaks, but a far better option is to adjust the Keep Options. Do this in your Paragraph Styles if you have them. (And if you don't, create these first! It may look like an amount of work for not a whole lot of immediate result, but as you work longer on your text, you'll appreciate InDesign automatically applying your settings. It's also easier to change the entire look-and-feel of your text whenever you feel like it.)
For regular body text, use "Keep Lines Together > At Start/End of Paragraph" (the Start and End values of
2 are usually enough). This will automatically avoid widows and orphans – a single first line of a paragraph at the bottom of a page, or a single last line at the top of a new page.
For headings, use "Keep Lines Together > All Lines in Paragraph" so you do not get a page break inside a two-line header, as well as "Keep with Next > 1" so it will always be kept with the following sub-header and/or plain text paragraph.
"Keep with Previous" is not needed (and actually a nuisance) for plain text and headers. It's useful only for a few select cases, such as on the very last item of a list which could otherwise end up on a new page on its own. Keep this deselected otherwise.
The bottom option "Start Paragraph: xxx" can be useful if you want certain content to always start in a new column/on a new page, such as a chapter title. For regular text and headings, leave it at "Anywhere".
If your paragraph style settings are correct but you still see different behavior in your text, check for local overrides on the offending paragraph(s). Also check the paragraphs above and below, because "Keep with Previous" and "Keep with Next" have an effect on other paragraphs.
If you made sure to use Paragraph Styles throughout, you can conveniently check if there are any overrides with the Style Override Highlighter:
This button will show local overrides on plain text with a colored background, and on paragraph settings with a colored sidebar. In the picture I manually changed the Keep settings from their style defaults and so that paragraph gets marked for closer inspection.