Minecraft wiki entry for Redstone_components, associated text: When placed, a detector rail lines up with adjacent rails, powered rails, and other detector rails, as well as adjacent rails one block above it. If there are two adjacent rails not on opposite sides, or three or more adjacent rails, the detector rail lines up in the east-west direction. If there are no adjacent rails, the detector rail lines up in the north-south direction. If there is an adjacent rail one block above, the detector rail slants to match it (when there is more than one adjacent rail to slant toward, the order of preference is: west, east, south, and north). Other configurations can be created by placing and removing various rail.