The keyboard usually stops working when the tablet isn’t detecting the pogo‑pin connection properly. It’s worth cleaning the metal pins on both the tablet and the keyboard, because even a tiny bit of dust or oxidation can stop it from registering. A dry cloth or a cotton bud with a tiny bit of isopropyl alcohol works well. After that, have it restart the tablet fully and reconnect the keyboard firmly so it clicks into place. It should normally show “Accessory connected”, so if nothing pops up, the tablet still isn’t seeing it.
Safe Mode is also useful — if the keyboard works there, then an app is interfering. And checking for software updates is worth doing because Samsung has pushed fixes for keyboard issues before. If none of that helps, it’s often a hardware issue inside the keyboard itself. The internal flex cable can fail after a year or two, even with normal use. Samsung sometimes offers goodwill repairs or discounted replacements, so it’s worth contacting them if it’s only 18 months old.