When you pull the keyboard from the Surface, make sure you have one hand on the keyboard, and pull straight up on the Surface. I've seen people "peel" the Surface from the keyboard, from one side to the other. That seems to put stress on one side of the magnets, which then causes it to rip out.