I notice you already have this question for the Holocaust but haven't found it for the Spanish expulsion. I understand that many great people gave reasons for it, like the seder hadoros, tsror hamor and ohr hachaim of yosef yaavets linked below. Perhaps you know of many others. Why did the Jewish people deserve the Expulsion?
We are told many times throughout the Torah and Tanach that we will be spread to the four corners of the Earth among the nations and that....
וּבַגּוֹיִם הָהֵם לֹא תַרְגִּיעַ, וְלֹא-יִהְיֶה מָנוֹחַ לְכַף-רַגְלֶךָ; וְנָתַן יְהוָה לְךָ שָׁם לֵב רַגָּז, וְכִלְיוֹן עֵינַיִם וְדַאֲבוֹן נָפֶשׁ.
And among these nations shalt thou have no repose, and there shall be no rest for the sole of thy foot; but the LORD shall give thee there a trembling heart, and failing of eyes, and languishing of soul (Dvarim 28:65)
All are troubles throughout history are pointed to from this pasuk... We, as a nation, will never have long lasting peace and security living among the nations.... this is all to remind us that we don't belong there and it is not our destiny to remain in galus.