The answer to your question is yes. Many times discoveries in astronomy are serendipitous in nature - some of the most well-known discoveries fall into this category: the discovery of the cosmic microwave background, the discovery of some of the planets in our solar system, are but two examples of this.
However, many times they are not serendipitous. Astronomers plan to discover things - look at the Kepler satellite which finds nearby exosolar planets by detecting planetary transits. The Sloan Digital Sky Survey was a planned galactic survey which gave us new insights about the properties of galaxies as well as structure formation.
One also has to consider time scales. Many things astronomers care about have timescales which are millions or billions of years (merging clusters, the evolution of main sequence stars, etc..), however, some phenomena are on very short time scales, namely supernovae. Microlensing events can also be somewhat serendipitous in their discovery, though researchers still devise experiments to look for them (see OGLE).
It is certainly a combination of luck and planning. This answer was intended to be a bit vague, since the question doesn't specifically ask about one phenomenon. Software does play a big role in identifying and classifying objects and events in the universe. I can talk a little bit more about this in the context of gravitational lensing if people care to know about it.