In English, "I read by the red lamp" sounds to me as if the red lamp is providing the light for your reading (= I read by the light of the red lamp), but the red lamp could be anywhere, perhaps in the next room.
But the Hungarian can't be used like this, can it? It merely expresses that I am reading, and I am by the red lamp (which may not even be switched on), right?
So, the same as "I am reading next to the red lamp." (Would that be an acceptable translation as well?)
Very interesting question. This sentence does tell me that I am at, or next to, the red lamp. Purely location. Btw., "light" is "fény" in Hungarian. It does not carry the other meanings of "light".
But I can think of sentences, more general ones, that convey the meaning of what provides the light, and not necessarily the location:
"Lámpánál olvasok." - "I read by lamplight."
"Gyertyánál tanulok." - "I study by candlelight."
"A piros lámpánál olvasok." - gives me more of a sense of location.
"Piros lámpánál olvasok." - gives me the sense that a red lamp is providing the light for my reading.
Regarding "at the traffic light".
I'm quite sure you prefer using "at" when you have business to do with the object in question - waiting at the door, sitting at the table, walking at the beach.
"By" is rather used if you just happen to be nearby the object, but not interacting with it - waiting by the statue, sitting by the table, driving by the forest.
-nál/-nél denotes no certain direction. You're just in the very proximity of the object. Mellett does denote a specific direction: left or right of the object, to the side, be-side.
They are often interchangeable, but not always. If the object in question does not have a certain frontside or direction, it does not matter. But once you get to things like buildings, cars, furniture, etc., it starts making a difference.
Just like "The store is next to my house" (neighbouring) means something different than "The store is by my house" (closeby), so does "Az üzlet a házam mellett van" differ from "Az üzlet a házamnál van."