It will happen from time to time. A key snaps off the laptop keyboard. It just happened to one of my son's, probably as a result of an argument with his big sister but that's not relevant here. What is relevant is how pleased I was to be able to put it back on again.
The keys have three components: the flattish bit with the letter, number or symbol on, a retainer device (usually plastic) and a metal clip which is unlikely to come away, being well fixed to the base around a squishy bit that handles the pressing of the key to make it work.
If you're lucky, just the flat bit with the symbol has come off. You can take these off with your fingers relatively easily, in fact, and they will snap back into position with a satisfying click.
If you're not so lucky, the retainer clip will have come off too. It may not be very obvious but a bit of careful poking around with a small screwdriver should separate the top of the key from the clip. You may find you can fit this back into position but if you're not sure which way up or where it locates itself, take another key top off and that'll give you an idea. Mine took a bit of fiddling and experimentation but it did eventually stay put.
Then you should be able to snap the key top back on.
If something has actually broken then spare parts are available and inexpensive - unless someone's damaged the base itself, I suppose.
All this I discovered by visting the excellent site called Laptop Repair Help which has nice photos and links for spares. Brilliant. Another reminder of just how the world has changed. One Google search and up comes the answer. I can't think of how many trips to shops, calls and messages that would have taken by any other method, let alone cost!