Multiple factors are to be considered when talking about spotting and visibility:
Surface detection range, which determines the range at which your ship can be detected by an enemy. To trigger such detection, the spotted ship must be in the spotter's line of sight.
Firing main battery increases detection range to that of that battery's maximum range. This increase in range will hold for 20 seconds after the firing.
Anti-air armament does not affect the detection radius at this point.
Active fires on a ship increase its detection radius by 3 kilometres, the number of fires on board, does not, however, affect this increase.
Skills like "Look at Me Now", upgrades and camouflage also affect ships' detection radius, and you can see the exact numbers when you apply either of them by checking the "concealment" section of the "stats" tab of your ship.
Sonar and Radar consumables detect ships automatically within a fixed radius when activated, even if those ships are not in the line of sight.