Knowledge of spells comes from the spellcraft skill. So a sorcerer could study spell effects while only being able to cast those in their blood. Or they just know it.
For sorcerers especially, I think just intuitive. You get the power and it increases with experience. When you get new spells, you just kinda know what they do. Maybe you don't know the title of the spell as classified by a wizard but you know what it does.
It would be about as much as a normal person knows about cell phones.
They can dial up the spell they want reliably. They are not sure what all those options do together, but they've found a way that works for them. Ask them about how two spells interact and they shrug unless they've tried it in the past.
They would have no understanding of the why, just the how.
It's more strange for clerics that don't put ranks in knowledge arcana or spellcraft in my opinion. At least sorcerers are limited to same spells everyday. For a cleric that knows nothing about magic I'm not sure how you explain changing which spells you prepare. "I was worried about being grappled today and somehow my god provided a spell that would protect me for ten minutes per level. Now if only I could do something about being set aflame..."
I like to imagine that the Cleric gets out his religious tome and looks in the index.
Blessings to deal with...
...Combat Prowess (multiple entries) -- Nope
...Disease -- Nope
...Fear -- Nope
...Healing (multiple entries, some cross-referenced) -- Nope
...Movement -- Great, now let's go down the sub entries!
Where there's no defined mechanical answer, I think we should assume that characters know the things they need to know. A sorcerer should not just know about the spells they can cast ("I levelled up last night - I'm pretty sure I can cast Resist Energy now, even though I've never tried.") but they should also know about the ones they can't cast. ("I'd like to buy a scroll of a spell that causes invisible creatures to appear, if such a thing exists.")
Role-playing massive ignorance about the world you're in is too self-destructive. Does an archer know which creatures have DR/Cold Iron? Probably not. Does he know that buying Cold Iron arrows might be a good idea? Definitely.
I don't know, I feel like it should happen more often that a cleric or similar caster should get into situations where what they want to cast is protection from energy (fire) and what they end up casting is spell immunity (fireball) instead. A sorcerer casts the same spells everyday so it doesn't seem odd to me that they'd be able to get by on feel. For a cleric it just seems odd, however.
In a similar vein I can only imagine how much could go wrong casting planar ally with any planar knowledge.
For the divine guys, I see the prayer session to get the spells as something of a shopping list. If you're being granted divine powers, there's no reason for the power itself to not give the info on the spells. Whether you as a caster can use that info properly, or remember how Flame Strike works when you went with some other spell that day? Spellcraft ranks. Get 'em.
@ p-sto The responding ally for a planar ally is picked out by the diety (a.k.a. the GM); the most the caster does there is make a request.
Planar binding, on the other hand...
@ OP - I've always assumed a character knows how their own spells and powers work (unless the player specifically wants it done otherwise).
And similar, a lay person may have a basic awareness of what sort of spells are out there and will recognize them for what they are once the effect goes off. (like, there's not all that many things that generate a giant but narrow pillar of fire, or a giant wall of translucent buzzsaws.)
BretI's cell phone analogy is pretty good for this.
An adventurer with with 0 ranks in spellcraft or knowledge (arcana) should reasonably know that invisibility and fly and fireball are all things, but would lack the know-how to recognize someone else actually casting one of those (though would recognize the effect once it happened).