They are both correct, but they have different meanings.
1. She dropped the tray when I spoke to her.
If both verbs are in the past simple, the events happened in sequence. The second event happened immediately after - and as a CONSEQUENCE of - the first. We'd assume that the woman was so shocked and surprised by the speaker's words that she dropped the tray.
2. She dropped the tray when I was speaking to her.
This is odd, but it is grammatically possible. I means that the woman happened to drop the tray during the time that the speaker was talking to her. This would be a strange thing to report. The only scenario I could think of is this: the speaker is worried about the woman's wellbeing, and is reporting their concern to another person after the event. The fact that she dropped the tray might be a symptom of an illness, and the speaker is reporting this to another person as evidence. Or perhaps she's just clumsy, and the speaker is giving evidence of the woman's unsuitability to be a waitress. Whatever the reason, the key point here is that the two events ( the dropping of the tray and the fact of the speaking) are probably UNCONNECTED. The phrase "when I was speaking to her" simply gives some background information to set the incident in some kind of time frame. This is the function of the past continuous.
If you are doing a grammar exercise and you have to say which one is correct, or a gap-fill exercise where you have to put the verb in the correct form, I would choose the first sentence. It is a more likely scenario.