(From the perspective of the electronics, that means the displays were drawn sideways.)
Not necessary. There is no inherent reason for drawing sideways. A video circuit can easy be made for either, as line width and number of lines can be defined either way.
This is especially true for early games, where electronics were rather special to type and so was mounting of screens - which usually was done locally anyway.
Maybe it was just an aesthetic judgment on the part of the designers, feeling they would look better that way, in which case fair enough, aesthetic judgments are what they are.
Isn't it always about aesthetics? Or in this case all about the game to be played? After all, when climbing up a gantry like in Donkey Kong, you want an upright scenery. Similar for shoot em ups, where more upright space means more room for aliens and their manoeuvres.
Due the same reason other games, like Battlezone or Defender do benefit from landscape orientation, so their machines had screens mounted sideways.
Same reasoning as why we use paper upright for writing but sideways for schematics.
But was there any technical factor that encouraged such orientation?
No.
Anything in the electronics, the mechanics of the monitor placement, the optics of its display in a vertical cabinet?
Neither electronics nor mechanics care for orientation. A tube can be mounted in any orientation. Similar a the beam can be moved to any location in any sequence - thus not even picture orientation and screen orientation need to be aligned. Of course it does make sense to format and place a picture in a way to use maximum screen size.
The real question is rather, why today's run almost exclusive sideways?
The answer here is due the way TV was set up. Game consoles and later home computers had to go along to use this resource. The Vectrex, bringing its own screen, is a great example that without the need to fit a TV an upright screen might have be more desirable for games.
It started as well a feedback loop. While vertical scrollers worked great on arcade machines with upright screens, they mostly sucked on landscape. Here side scrollers like Sonic, simply showed a better utilization.
Zaxxon is kind of an interesting hybrid. It combines the forward dynamic of a vertical scroller with the real estate of landscape mode. I find it as well notable that there was a whole generation of isometric games, quite often from UK developers, doing alike.
By why as well with dedicated computer screens?
Simple answer: Price. For professional use it's mandatory to have at least 60, better 80 characters per line. Having more lines is great, but highest priority is having a full line displayed at once without scrolling or warp.
Hardware wise this could easy be reached, already early on, in portrait orientation. But to display the text in similar size, an upright tube needs to be larger than one used sideways. For example a 12 inch screen (4:3) in Landscape offers about 20 cm per line, which is roughly like on an A4 sheet. To do the same in portrait, it needs a 16 inch tube.
Larger means the tube itself is a expensive part. Any resulting monitor was, despite having otherwise the very same parts, more expensive. And by now similar software adaption as with video games happened. Modern desktops are adapted to sideways screens (*1). So even with most modern screens being able to swing in either operation sideways will prevail (*2).
So while the result of having sideways screens as default is the same, evolution converged due different reasons. Personally. I still feel nostalgia for the Star systems with their huge upright screens.
*1 - I'd say even a reason why PocketPC failed early on, as upright phone screens just need a different UI.
*2 - Then again, with 30" 4k screen sizes reached today, it's more akin to human nature to turn the head to access more screen space than up and down - likewise mouse are more easy sweeped sidways. So I guess even if we had lived in a socialist society making money not a reasoning, we would by now as well reach a time with screens becoming ever wider.