Reboot your phone or tablet.
Restarting your device can help fix minor issues and may help the S Pen connect again. On devices with a regular Power key, press and hold the Power key until the Power menu is displayed. Tap the Power icon at the top of the screen, and then tap Restart. Tap Restart again.