Rudder lock requires a mechanical linkage between the rudder pedals and the rudder. With no force on the pedals, the rudder will then weathervane (float) into an equilibrium position that depends on the sideslip angle and the hinge moment coefficients of that particular rudder.
With enough sideslip angle the rudder will hit its deflection limits and stop to move further. If the sideslip angle still increases, the difference between the maximum deflection and the theoretical floating angle (if there were no mechanical stops) will determine the aerodynamic force by which the rudder is pressed into the stops.
At this point the rudder will exhibit fully separated flow on its leeward side, but that only changes the hinge moment derivatives and the resulting floating angle. Normally, the ratio between the change in sideslip angle and the resulting change in floating angle is less that one for small angles but increases above one for larger angles. This means that the rudder will experience a steep hinge moment increase for small increases of the sideslip angle once it has reached its maximum deflection.
How far the pilot is able to overcome those forces and bring the rudder back to neutral depends on the size of the rudder and the dynamic pressure. Ideally, he/she would never allow the rudder to float, which also should ensure that sideslip angles stay low. However, in some maneuvers like a sideslip you want high sideslip angles, and there a locked rudder is quite normal.
When I was flying the Schempp-Hirth Discus, I could either float gently into a sideslip with moderate angles and no rudder lock, or violently swing the aircraft into the sideslip, which resulted in a higher trimmed sideslip angle and a locked rudder. However, rudder forces in a glider are low and ending this condition was trivially easy.
I also witnessed a crash in my career when a test flight with a marginally stable aircraft went wrong. The aircraft was flying at Mach 0.7 and had a fully mechanical rudder linkage. The pilot had taken his feet off the pedals and the aircraft went into a sideslip when he did aileron doublets. Only when the rudder deflection had reached 10° did he try to correct that condition (at this point the sideslip angle was also about 10°), but the deteriorating directional stability at higher sideslip pushed the aircraft into a maximum 27° of sideslip. Since the maximum rudder deflection was only 20°, the aircraft regained some stability with the locked rudder at the maximum sideslip angle and ended up in a yaw osciallation between 17° and 27° of sideslip. The pedal forces involved were too high to be overcome. Unfortunately, the tail was a T-tail and produced a strong pitch-down moment with those higher sideslip angles, and also the stick forces were too high to correct that. In the end, the aircraft dove into the ground.