I was wondering if whether we were extremely lucky to have found spectral (absorption) lines of astronomical objects because they fell within the visible light range or if there something intrinsic about it. In the same direction, is there spectroscopy analysis within other light frequency ranges?
The Balmer series for hydrogen is an example with some visible lines, and some lines outside the visible spectrum.
On the other hand, the Lyman series for hydrogen is completely outside the visible spectrum.
Since every element has an infinite number of spectral lines, it would instead be very unlucky if they all somehow fell outside the visible spectrum.
There is no luck involved. Quite the opposite. Firstly, as many of the comments say, spectal lines arise in a very wide range of frequencies well outside the visible range. Secondly, and IMO more importantly for this answer, evolution is NOT random. And we see in the visible range because:
"Most" of the Sun's radiant energy is in this band, in the sense that if you look at the blackbody radiation curves for different temperatures (see below, which I swiped from the Wikipedia "Wien Displacement Law" page), the one for 6000K (the Sun's surface temperature) has its peak smack in the middle of the visible range. So there is naturally an evolutionary driver for an evolving organism's EM sensory system to sense where the sensed quantity (EM radiation in this case) is strongest.
Optical frequencies are one of the regions where matter interacts strongly with light. This is exactly the frequency range, for example, where metals begin to behave like lossy dielectrics rather than perfect conductors and where much of the spectrums of organic molecules lie. Therefore, as the light sensing system's evolution goes forward and becomes more elaborate, it will become most sensitive to the spectrums (the "colour" of the light transmitted and reflected by) of the molecules making up predators and prey of the evolving organism. Once this process began, it became ever more complex: organisms began using the spectrums of these organic molecules for sexual signalling (birds, butterflies, fish with four-colour, polarisation sensitive sight), angiosperms took advantage of this and evolved colourful flowers to dupe other animals into pollinating them and so on and so forth. We primates, for example, became one of the few mammals to rehabilitate our red receptors as we became diurnal and omnivorous: red helps detect and analyse fruits and berries.
So, in short, because there is a great deal of Sun's radiance as well as organic molecule spectal activity in the visible range, life evolved with evolutionary drivers grounded on these facts, and not the other way around.