The most direct rule about this is in the Player's Handbook p.204, in the spellcasting rules, under "Targets":
Unless a spell has a perceptible effect, a creature might not know it was targeted by a spell at all. An effect like crackling lightning is obvious, but a more subtle effect, such as an attempt to read a creature's thoughts, typically goes unnoticed, unless a spell says otherwise.
To expand on that, from the Sage Advice Compendium, we have this question and answer:
Do you always know when you’re under the effect of a spell?
You’re aware that a spell is affecting you if it has a perceptible effect or if its text says you’re aware of it. Most spells are obvious. For example, fireball burns you, cure wounds heals you, and command forces you to suddenly do something you didn’t intend. Certain spells are more subtle, yet you become aware of the spell at a time specified in the spell’s description. Charm person and detect thoughts are examples of such spells.
Some spells are so subtle that you might not know you were ever under their effects. A prime example of that sort of spell is suggestion. Assuming you failed to notice the spellcaster casting the spell, you might simply remember the caster saying, “The treasure you’re looking for isn’t here. Go look for it in the room at the top of the next tower.” You failed your saving throw, and off you went to the other tower, thinking it was your idea to go there. You and your companions might deduce that you were beguiled if evidence of the spell is found. It’s ultimately up to the DM whether you discover the presence of inconspicuous spells. Discovery usually comes through the use of skills like Arcana, Investigation, Insight, and Perception or through spells like detect magic.
In general, I would think for any effect that deals damage, you know when you've been affected by it unless it specifically says you don't. Even if you save against it, you presumably experience some of the pain, intrusive alien thoughts, and/or whatever else the DM uses to describe the nebulous concept of "psychic damage"; you're simply able to resist it and it doesn't badly affect you. So based on that, a mind blast should be very obvious to anyone making a save against it, even if they succeed. There are exceptions; for example, apparently your target may not realize vicious mockery is actually a magical attack rather than just a really, really hurtful insult.
As far as Dominate spells, it seems it would be largely up to the DM, but my instinct would be that Dominate is a very overt form of mind control -- it isn't a subtle charm or suggestion that makes you think "Oh, yes, that would be a good idea", it's just grabbing your brain and driving you around like a car, and you probably would notice that.
As to immunities, again, this is again up to the DM, but I would say you should follow the advice given above. A sleep spell is likely intended to be subtle, and goes unnoticed by those who save against it or are immune. Even those who fall to it may not later realize they were magically put to sleep, depending on the circumstances -- if an employee falls asleep at his desk, he's likely to chalk it up to lack of sleep and a too-warm office, while four guards who all simultaneously fall asleep at their posts will probably suspect magical trickery.
That said, a creature that's immune to a given condition or damage type may not even notice overt attacks, depending on their nature. For example, many undead are immune to the poisoned and exhaustion conditions, and in context, probably they aren't even really aware of such things -- they're immune because they aren't driven by biological processes, so things like "get real tired" don't have an impact anymore. So if they don't actually see you casting a (wholly theoretical) wave of fatigue spell at them, it's likely they wouldn't even realize you did anything.
An animated object or clay golem is immune to psychic damage because there just isn't a mind there to affect, so it's entirely reasonable that they might not even notice the attempt. Conversely, a couatl is so mentally powerful and so well-defended that they are immune to the psychic damage type, but they are very likely still aware of psychic attacks, in the same way that a frost giant knows you threw a cold attack at him -- it just didn't hurt.