On-page optimization is the practice of ensuring the content of a page is set up to be relevant for the search queries being targeted. It is a crucial part of most SEO campaigns - if the phrases you are hoping to rank for don’t appear on the page, it will be much more difficult to achieve your goals.
Remember, the content of a page and its associated meta data are just some of the factors considered by search engines when ranking pages for specific queries. The fact that individual web owners have full control of content means that these cannot be the only (or even the most powerful) ranking factors, as they could easily be manipulated. As such, they are typically only part of the puzzle, but not sufficient enough to rank for even moderately competitive phrases on their own.
At an overview level, the process looks something like:
In general, the search engines are very good at recognizing synonyms, understanding stemming (i.e. understanding that different participles of verbs and plural vs. singular nouns refer to the same core concepts. For example, that “running marathons” and “ran a marathon” are about the same essential things).
For this reason, and also because on-page factors are necessary but not sufficient for ranking well, it is important to write first and foremost to delight users and only consider keywords and phrases as a secondary factor. It is far more important that users like, share and convert from your pages than having the specific phrase you are targeting squeezed in one more time. Bear in mind throughout all the tips that follow that they should all essentially be prefaced with, “As long as you aren’t impacting the readability of the page...”.