に気づいて

notice

→ に
phrase Rare #23,861
notice に marks what is noticed. 気づいて is the te-form of 気づく and can connect to what happens next.
JA: 間違いに気づいて、すぐ謝った。
EN: I noticed the mistake and apologized right away.

トムは自分の間違いに気づいてたんだ。

Tom realized his mistake.

彼は自分の誤りに気づいていないようだ。

He doesn't seem to realize his mistake.

彼は危険に気づいていなかった。

He was unaware of the danger.

私は彼女がいる事に気づいていなかった。

I didn't realize she was there.

彼は身の危険に気づいている。

He is aware of the danger he is in.

しかし、主人公は自らの誤りに気づいている。

However, the protagonist realizes their own mistake.