Flow separation along the surface of the rudder results in stalling. This can be caused by having defects on the leading edge of the rudder (nicks, seaweed, trash). Overloading the rudders can also cause them to ventilate (suck in air) which creates a bubble on the leading edge of the rudder causing separation. This is usually caused by steering too hard or having an imbalanced helm. Cheap, flexible rudders are also more prone to stalling.
The best things you can do to prevent rudder stall is to first, buy the best rudders you can afford (EPOs if you can swing them). Then take care of the rudders, keep them polished and smooth and fill in any nicks that develop. And last, make sure your helm is balanced (only a light weather helm) and be gentle in your steering.
If you do happen to stall your rudders while sailing, what you need to do to re-attach flow is to dump the mainsheet to unload the rudders and then bear off a lot to get the flow reattached. Then you can turn back up wind. You can also wiggle the rudders sharply to try to reattach flow. If it's windy, also be sure you have plenty of downhaul pulled on. This will force the CE of the mainsail down and forward which takes some of the load off the rudders. If you're sailing in weedy conditions, it's a good idea to clear your rudders often by kicking them up and then putting them back down.