You shouldn't have a problem getting to the airport in time for a 9pm flight. The race should finish ~3.30pm, if you start walking straight back to the "Black Line" (Linea Nero) shuttle bus you should beat most of the crowds, although this depends where on the circuit you're planning to watch the race? From the pit straight it should take 20-30 minutes depending on how fast you walk.
In the past couple of years I've not had to wait long to board a shuttle bus, there are plently in operation, you should be able to make it to Monza train station before 5pm. If you're desperate for time you could queue jump (never done it myself but I've seen plently of locals do it). Trains to Bergamo are every hour and as the vast majority of people will be going to Milan you should have no problem getting on board a train to Bergamo.
The trains from Biassono Lesmo (station at the circuit) only go back to Milan and as another person mentioned they are very crowded.
How are you getting to the circuit? I would advise buying your return tickets for the train and shuttle bus in advance to avoid any holdups. You can usually buy GP train tickets from the major stations which include a return pass for the circuit shuttle bus. In Bergamo station you can get these from the automatic ticket machines.
A bus from Bergamo train station to the airport will take around 15 minutes, you can download timetables from the ATB Bergamo web site.
So yes I would say it's perfectly possible to get back to Orio Al Serio in time for a 9pm flight, as long as you don't hang around for too long after the race