Hi Rub B,
Yeah, this comes up frequently; there are a lot of manufacturers that attach their keyboards this way. It makes for a good connection between the keyboard and the case, but it's also a pain in the wazoo for those of us who have to replace one. I've dodged that bullet myself because I found a top case that came with the keyboard cheaper than the keyboard by itself, but I did look into it in preparation.
Generally there are two main methods of separating them; first is by using an X-Acto knife to cut the tops off, and the other is to melt them with a soldering iron. The X-Acto knife is cleaner, but the soldering iron tends to be faster.
As far as reattaching them, the quickest solution I saw suggested was with a hot glue gun. Place the keyboard down over the plastic stubs and everywhere there's a stub, put on a dab of hot glue. I'm told it worked well and held the keyboard securely. The approach I had intended to take was to get some of the leftover plastic rods from building a model car and using those as a kind of solder substitute to weld the plastic stubs with a blob of plastic back on top. The other thing I considered was finding a bunch of self-tapping screws small enough to go into the plastic and screw the whole thing down.
Those are the best ideas I came across; hopefully one of them will appeal to you and be workable for your repair.
Good luck; let us know how it goes!