So, Frodo puts on the ring while at Amon Hen and within moments, Sauron starts looking toward him. If not for Gandalf’s interference, he’d have been seen.

But, mere seconds later, Frodo puts the ring right back on again and heads to the boats and is apparently not seen.

Much later, Sam puts on the ring in Mordor to chase after Frodo, but he’s not seen by Sauron. Then, at the last moment, when Frodo puts on the ring in Mt Doom, Sauron is instantly aware.

Putting on the ring in the Shire appears to never alert Sauron, but does alert the black riders when they’re close.

I have no doubt that there are rules being applied here. Tolkien never does anything randomly. So, what are the rules? Is there something magical about Amon Hen that made it especially dangerous? Is it simply being on top of a hill so that there’s a clear line of sight between Barad-dûr and wherever the ring is?