Block Signals are used to indicate and control the flow of traffic over the rails. For more information on their use, see Signalling.
This is the most basic Signal, both a Block Signal and a Controller, typically forms the heart of a Signalling System. It must be placed near a rail in order to form a valid Signal Block. The exact distance it can be from the rail is somewhat hard to define, but it must be within two tiles horizontally, and four tiles vertically. You don't need to place the signal on both ends in the same configuration relative to the rail, all that matters is that the rail forms a straight line between the two signals.
When searching for a rail, it will look below it first, then one tile to either side, and then finally two tiles to either side. If two rails are equidistant to the signal, the exact rail picked will vary on the implementation of the search algorithm. It's considered best to avoid such configurations, as there is no guarantee they will remain valid between updates.