It Depends on the spell. And on your DM.
This is true for trying to cast a spell through any type of cover - whether it's a brick wall, an illusory wall, a curtain of tissue paper, a glass wall, a swinging door. I'll give you a couple of examples.
I am using roll20 compendium and DnD 5e Wikia for spell descriptions.
Magic Missle:
You create three glowing darts of magical force. Each dart hits a creature of your choice that you can see within range. A dart deals 1d4 + 1 force damage to its target. The darts all strike simultaneously, and you can direct them to hit one creature or several.
First of all, you must be able to see the target. This means that of the above options, you can target something only through the glass wall. The missles might do enough damage to break the wall, but as they are all traveling simultaneously, they will not penetrate. This depends on your DM.
Witch Bolt:
Make a ranged spell attack against that creature. On a hit, the target takes 1d12 lightning damage, and on your turn, you can use your action to deal 1d12 lightning damage to the target. The spell ends if you use your action to do anything else. The spell also ends if the target is ever outside the spell's range or if it has total cover from you.
"Cover", specifically, is physical. A glass wall therefore, is total cover, so you can cast the spell, but it would instantly end, which would mean you just wasted a spell slot. Same goes for the brick wall. You can cast it through an illusory wall, though if you don't know that it is illusory, you probably shouldn't risk it. Because the spell launches a bolt of force, and not anything physical, it will not swing the door open, and while closed, it is total cover. As for the thin curtain, this is up to your DM. If I were DM, I would say that the curtain is not total cover, but would make you roll at disadvantage to aim well at the target that you cannot see.
Detect Thoughts:
The description says you need to see the creature, so only the glass wall would work. Because you are not sending anything at the creature, and are only "looking through its mind", the glass wall would not hinder you. Unless you have a mean DM.
Suggestion:
You must be able to see the creature, and the creature must be able to hear you. The swinging door might work if it has a glass window, but otherwise, none of the options would work.
Sleep:
You can most definitely choose the point to be behind any wall, but your ability to aim well will be hindered. If you choose the point on your side of the wall, your DM might rule that creatures that cannot see the point do not fall asleep, even if they are within 20 feet.
For any spell: Some DMs might rule that there cannot be any cover at all. Some might rule that you must always see the target. Modifying the vaguer rules in 5e is one of the purposes of DMs.
As for the last question: If the spell says that the target must be seen, than a blindfolded wizard cannot cast it. Otherwise, it is up to your DM, but you can expect to aim much worse.