When you realize you might have left your Facebook susceptible to suspicious tampering, head to Account Settings > Security > Active Sessions on mobile, or Where You're Logged In on desktop. You'll see a long list of locations and devices where your account has been recently active. Once you spot the device in question, tap the X, and it'll remotely log you out.
Don't completely freak out if you see a bunch of unfamiliar login locations. When you're on your phone, the app is pinging off nearby cell towers, some of which may be quite far from where you were actually standing. But still, if you're somehow still logged into your ex's computer in Idaho, close that shit stat.