I would recommend reading some basic resources on current Cas9 technologies. Here is one such review on prime editing, which illustrates one mechanism by which you can force cells to use a favorable precise repair mechanism. The way that you do this is by providing a repair template as part of the guide RNA that can be directly incorporated (see figure illustrating mechanism).
Properly, this mechanism uses neither of the two pathways that you mention:
Since almost all precise repair strategies generally require repair templates, they must exploit the endogenous HDR machinery, restricted to dividing cells. This has been a bottleneck in therapeutic applications of gene editing, especially for the many neurological diseases involving mutations that affect post-mitotic neurons. However, as [prime editing] bypasses the need for HDR machinery, precise genome substitutions were observed (albeit at low frequency) in primary mouse cortical neurons.

Note that this is only one example of how you can control repair mechanisms. I suggest reading that review (Scholefield and Harrison 2021, Gene Therapy), which includes information on other methods such as base editing.
As for distinguishing NHEJ vs HDR, there are a variety of references on this that can easily be found by google, such as this one. I'd recommend doing some cursory research there as well.
Your questions should be reasonably scoped. If you can imagine an entire book that answers your question, you’re asking too much.
The regulation of DNA repair is a huge subject, and books have been written about it. Please edit your post so that it focuses on one discrete, specific question that can be answered in a few or several paragraphs. Additionally, please include the research you've done so far to try to answer the question on your own. $\endgroup$