The creature is always aware.
Let's get the whole paragraph of that part of the Detect Thoughts spell up to analyze.
"You initially learn the surface thoughts of the
creature—what is most on its mind in that moment. As an action, you can either shift your attention to another creature’s thoughts or attempt to probe deeper into the same creature’s mind. If you probe deeper, the target must make a Wisdom saving throw. If it fails, you gain insight into its reasoning (if any), its emotional state, and something that looms large in its mind (such as
something it worries over, loves, or hates). If it succeeds, the spell ends. Either way, the target knows that you are probing into its mind, and unless you shift your attention to another creature’s thoughts, the creature can use
its action on its turn to make an Intelligence check contested by your Intelligence check; if it succeeds, the spell ends."
Due to the nature of the final sentence in which the "Either way" is, the creature will be aware it is being probed regardless. The "either way" is in reference to the option to learn surface thoughts, or deeper probing.
There would not be a second chance to end the spell "either way" the creature rolled. If the creature succeeded the Wisdom save, the spell would be over. This sentence would not have any use after that point. The spell either ends or does not. So the last sentence can't refer to the previous one in that regard. The only logical conclusion therein can be that it is referring to either surface reading and deep thought probing.
This means the creature is always aware that it is having its mind probed somehow. No matter how shallow.
Let's break this down further. There are several outcomes for this spell to have on a single target by the reasoning I've described:
You view the target's surface feelings. It is aware of your actions. It may make a contested Intelligence roll to end the spell.
You probe deeper into its thoughts. It makes a Wisdom saving throw. On a failure, you gain more knowledge of the target as described. The target is aware of your actions, and can make a contested Intelligence ability check to end the spell.
You probe deeper into its thoughts. It makes a Wisdom saving throw. On a success, the spell ends. The target is aware of your actions.
Now, in the other interpretation of this spell, the possibilities are as listed:
You view the target's surface thoughts.
You probe deeper. It makes a Wisdom saving throw. On a failure, you gain more knowledge of the target as described. The target is aware of your actions, and can make a contested Intelligence ability check to end the spell.
You probe deeper. It makes a Wisdom saving throw. On a success, the spell ends. The target is aware of your actions, and can make a contested Intelligence ability check to end the spell. (What?)
Yeah that last one didn't make sense to me either. This is my reasoning for my answer. Break it down and see what you come up with. Now, if the sentence was this instead, the latter would make far more sense:
Either way, the target knows that you are probing into its mind. If you do not switch your attention to a new target's thoughts, the target may contest Intelligence ability checks with you to end the spell as an action on each of its turns.
If they were separate ideas they would not be in the same sentence.