As with most troubleshooting, an important first step is to restart both devices. Turn your Bluetooth speaker off and back on, and do the same with your phone, computer, or whatever you're connecting to. This should resolve any minor bugs preventing a good connection. Once that's done, if they've been paired before, try reconnecting your device to your speaker manually using the device's Bluetooth menu. On an iPhone, visit Settings > Bluetooth, then look under My Devices for your speaker model name. Tap it and see if it changes to Connected. On Android, swipe down from the top of the screen, then press and hold on the Bluetooth icon. Select your device under Saved devices if it's there.
If that fails, you should remove the pairing between devices and re-establish a fresh connection. You can do this on the same Bluetooth menu. For iPhone, tap the i icon to the right of the device, then choose Forget This Device. On Android, tap the Settings gear next to your model name, then choose Forget (the trash can) to remove it. (Android steps may vary slightly depending on your model.)
To re-pair them, you'll need to put your speaker into pairing mode. This varies based on your model, so refer to the manual for steps on enabling pairing mode. Once it's ready, tap the speaker name on your phone's Bluetooth menu to reconnect. Sometimes, you might have to toggle Bluetooth off and back on in your phone's menu. My JBL Flip 5 regularly fails to play audio from my iPhone even when it says it's connected. Toggling Bluetooth usually fixes this without having to repeat the pairing process.