Regarding the first question, both are used to talk about hypothetical situations, however, the grammatical structure underlying in If I had known carries a nuance of regret (maybe the speaker was keen on her and would've liked to hang out with her). Although, if I recall correctly, using the following wording is more common Had I known....
In contrast, If I knew alludes to the present, referring to an action that is still untrue in the present.
In fact, both these grammatical structures have a name: the past and present unreal conditionals (This is what I do recall, if anyone could confirm or correct this I would gladly correct my answer).
All in all, the difference is in that slight nuance.
Regarding the second question, I do believe that the difference lies on the likelihood of the discussed hypothetical situation, from the viewpoint of the speaker.
Let's imagine that someone is asking you to do something that may end up having negative consequences. Let's also imagine you have some feelings for the person that is requesting you to do such a thing. For this reason, you might be considering doing it for the love you feel, in this case, you may say
If I do it, it will be a mistake.
despite the fact that from a logical view, it should not be done under no circumstances.
However, if you clearly thought it was a stupid idea, then you may say
If I did it, it would be a mistake.