I understand that the static test is a general test of pre-launch procedures, but risking a multi-million dollar payload for a test seems remarkable. Couldn't they use a mass simulator or something? Do they fuel the payload as well for the test, and couldn't that be done separately?
The static test wants to be done relatively close to launch day, to minimize the likelihood of anything happening to the engines between the test and the launch.
The more conservative procedure is to attach the payload after the static test, but they'd have to lower the rocket, move it back indoors, stack the payload, take it back out and reelevate it.
Static firing after payload integration saves a day or two, but puts the payload at risk if something like this happens.
The Transporter/Erector can only lift a complete first and second stage. That is not to say it requires the payload, but to say it requires the second stage.
Taking your question to next logical step, why do a static fire of the first stage engine with a $20 million second stage on board?
Well, they need it so the T/E can grab it and hold the complete stack.
A better question might be, for a Static Fire, why were they fueling the second stage at all?
Having said all that, there is an additional reason to test fire with the second stage, fueled, and with the payload attached is that the vehicle behaves different fully configured than in pieces, and this is a static test of the entire vehicle.
According to Peter B. de Selding on Twitter, SpaceX implemented an optional policy of attaching the payload to the vehicle earlier this year with some “insurer upset”, as it saves about a day during of launch preparations, and allows SpaceX to monitor the payload’s interaction with the vehicle. The customer can decline this option if they wish.
SpaceX performs a test fire of all their rockets at the pad, lasting for a few seconds. There is an option to place the satellite on top of the rocket, or to delay the launch by a single day. As the static fire test has been considered a low risk to the spacecraft, this has often been done, as a day can cost the commercial operators lots of money, and there has been low risk. Furthermore, it provides a realistic test of what the spacecraft will do on launch day. They can determine what the thermal environment will be like on the fairing, which might need to be adjusted for flight day. It also is a good chance for the satellite team to have a dress rehearsal.
As I understand it, there is a cap that is placed on the rocket if it doesn't have the payload. That cap needs to be removed, and the fairing attached, which takes a day.