How many ways are there to keep people from realizing that you are casting or have cast spell or used some other power like an invocation or spell-like ability? What are the chances of someone spotting you when you cast a spell?
This question comes up a lot because WotC wasn't clear about it.
A character casting a Still, Silent spell without material components or focus still provokes an attack of opportunity, unless you make a Concentration check. Doing so implies you maintained enough focus to keep your defenses up, rather than making the spell "invisible". Same thing with
spell-like abilities. Players won't like it if creatures with spell-like abilities can use them without drawing any sort of notice.
By the rules, you must cast a spell with a verbal component with a strong voice. Generally listening to a conversation has a Listen DC of 0, so it's not quiet. Alas, so many D&D novels have characters "whispering" spells that it's easy to think you can do so on the sly. There's no listed DC for noticing a character using verbal or material components or a focus. (Depending on the component and spell rarity, another character might not be suspicious. Although swallowing a live spider tends to draw attention, even if not hostile attention.)
In addition, many spells have an obvious effect.
Several spells don't work well if it's obvious. Charm Person, for instance. The charmee won't care until the spell has run it's course, but if you try to charm a noble in front of his courtiers, you're kind of in trouble. Charm Person is very strong, though, so I'd insist a PC take steps to hide the spell, perhaps inviting the victim into a room, alone. (Good luck doing that to a noble. Maybe a good Diplomacy check would help with that.) Something similar for illusions. Fortunately, if you cast an illusion that "makes sense", maybe no one will notice. Casting an illusion to make it seem like reinforcements are arriving might not work, because they might notice that you just cast a spell in a desperate battle to no effect. "Summoning" a powerful monster (that is actually an illusion) works better; it would take either interaction or a successful skill check to realize it's not a summon.
By the rules, even a small thorp probably has a 2nd-level cleric. Virtually all NPCs will have seen sdpellcasting and will recognize it when done, even though most don't have the skills to determine what spell is being cast or even if it is arcane or divine. Most spells cast by non-combatant NPCs aren't dangerous in the least, and many are indeed helpful.
Spells are a dangerous tool. People won't necessarily freak out at seeing a spell cast. After all, people tend not to freak out if someone uses a knife... at a dinner table. However, a knife is dangerous and multipurpose (as, say, a weapon), and if you're doing anything at all unusual with it, it draws attention. Suddenly casting a spell is akin to suddenly drawing a knife. Even if you're just going to use it as a tool, people may decide you're doing something dangerous with it. Even telling someone what type of spell you're going to cast might not allay suspicions, if they don't trust you (or adventurers in general), are prejudiced against spellcasters, against members of your PC's religion, etc. Someone might object to you casting Detect Magic at them.