LO comes with a component named Math, which you access with
Formula. It is rather simplistic but will do for most simple formulas. If you really need elaborate formatting, there are extensions to design formulas with the TEX macro language. Search the extensions site.
Automatic numbering is easy. The formula out of Math comes in a frame anchored by default As character. Change this anchor mode To paragraph to be able to position it more freely. You can then
Caption on the frame. Doing this, you can choose from the built-in categories, Drawing, Figure, Illustration, … or create your own category like Formula, Theorem, Lemma.
Each category name has an associated counter. If you press the
Options button in the dialog, you can select a number mode: document if level is [None], chapter is level is 1, … You can’t number by section if you use this word in its LO Writer meaning (not common sense where section = chapter, sub-chapter, …). A section is a part of page where you have a number of columns different from the enclosing page.
How a formula, theorem or lemma is distinguished from the rest of the test is only a matter of paragraph, character and frame styles. You define them according to your taste. Learn what they can offer to you in the Guides. There is one for Writer and one for Math.
Avoid the beginner’s pitfall: refrain from manually formatting your document, this is fine for experimenting but creates a formatting hell when it comes to an elaborate and highly-crafted document.
To show the community your question has been answered, click the ✓ next to the correct answer, and “upvote” by clicking on the ^ arrow of any helpful answers. These are the mechanisms for communicating the quality of the Q&A on this site. Thanks!