We all take our chances. If you are an average astronomer, it really depends on whether you have achieved some type of notoriety in research, and these interests match those of the institution with a position opening at the exact time you need a job.
Timing is everything in science.
You have to be 'on the market' at the same time as there is an opening for your dream position, and once hired, you have to get tenure by showing your ability to attract research money to your new department and to be regarded as a prolific and talented research scientist. Because there are twice as many new Phds in astronomy as there are stable jobs, institutions can pick and choose exactly what they want to hire almost down to the shoe size. You have to stand head and shoulders above every one else via your research, discoveries and your list of references to get a job. Stability is now an illusory goal for many of us. We just want to stay in the profession for one or two more years and consider ourselves lucky.