I'm with Cary
here in that the practical execution of the rectangles could tell us something about their in-universe purpose. Not through the underlying techniques of execution, tho, but through how the techniques end up looking on screen.
As pointed out, the four things are in fact three plus one. Thanks to the different ways of accomplishing them, three of the four symmetrically placed things are brightly lit while one is essentially unlit, asymmetrically and without in-universe rhyme or reason. This would be odd for a sensor emplacement, as our heroes never comment on a blind spot in their sensor coverage!
The rectangles are a bit unlikely to be marker lights for the ship's extremities, either - there are plenty of blinkies and beacons for that purpose already (and these tend to be working fine in the shots). However, if a lighted fixture instead indicates a lighted space beyond, it's pretty natural to think that sometimes a space might remain unlit, especially if it serves no crucial function 24/7.
It's clear that Starfleet maintains no "lighting discipline" and doesn't require shuttering even for instances of stealth (say, "Balance of Terror") - and conversely that shuttering isn't forbidden or subject to the CO's personal supervision. Okay, so we do see Kirk personally open a shutter in "Mark of Gideon", but that's a casual move rather than a command decision...
Large windows looking directly up are fairly "useless" because TOS features basically zero scenes where something would be located directly above the ship (the scenes in "Catspaw" or "Requiem for Metusaleah" would have been a bit outside the parameters of the starship designers, I think!). However, these might be useful docking aids during starbase layovers. Since those are scheduled events, it would be quite plausible for the crew to redecorate the underlying utility spaces into skylighted discoes, pool rooms and whatnot the moment the ship clears Earth orbit - and pretty natural for them to create four different "deep space entertainment" interiors, one of which permanently has the skylight shuttered or at least dimmed. (Essentially, then, I'm with Tin Man
and Admiral M
here on the designed nature of those spaces, while raising the possibility that they serve other functions besides the designed one and for this reason are sometimes lit even in deep space.)
Similar logic (not airtight, only the "better-than-the-nothing-we'd-have-if-we-didn't-have-this" sort) might be applied on the bow roundels of the saucer. Since we see (the middle one of) them blinking rhythmically in the early episodes, during an orbital departure scene, it's a bit unlikely that there would be a habitable space beyond them (save for a space disco having an orbital departure party!). A sensor system could go on and off rhythmically, though.
However, TOS-R and ENT offer us a "both and" option here. When the Defiant
sits idly docked in "In a Mirror, Darkly", somebody or something can be seen moving behind a bow roundel, indicating its transparency and porthole function. But that doesn't mean there wouldn't be sensors there. Quite possibly all the lit features have crew-accessible spaces beyond; it's just that the partial unlighting of the quartet of rectangles indicates spaces that do not need to be lit when "operating", while the flashing of the roundels indicates spaces whose lighting depends on machinery operating.