I've found lots of traps to maim and injure PCs, but have yet to find a good source of interesting puzzles that will make them think.
I often come across situations that do both. In such cases, one can with a bit of effort tease out the fundamental logic of the puzzle aspect and change the particulars -- including consequences.
As to constructing one's own, I think the basic necessities are:
1) Something initially unknown.
2) Evidence and inferences by which it can be discovered.
3) Some "trick" to require careful investigation, thus creating an interesting challenge.
Collections of "brain teasers" are good sources not only for specific puzzles but for examples of basic elements.
One thing that's pretty easy to do is to scatter through the environment things that may at first seem unrelated, and later clearly be related --- but maybe in an initially unknown way.
For a simple example, there is a door in one place and a key to open it in another. If there are no clues as to which key will open which door, then the problem is a dull one of trial by error. If doors and keys are labeled with a code that takes some reasoning to figure out, then the process of elimination might be completable without investigating the whole set.
Things with which players can interact and get different results tend to be quite engaging. The temptation to pull levers out of curiosity is pretty strong!