How to figure out the BCD my chainring has I have a 2017 Diamondback Line. My chain has come off a few times and this post says get this chainring. I wanted to confirm my bike requires a 104 mm bolt pattern but don't know how to do that; the specs only say "Alloy arm with 32T single ring."

I may not need a new chainring, it's probably my shifting because it usually only happens when I am pedaling hard and in a higher gear (not sure if lower or higher but a gear that requires more effort to pedal) but lets assume I do.
The bolt center diameter is just the circle around the crank axle axis that the center point of the chainring bolts lie on.

If you have a even number of bolts the diameter is fairly easy to measure. Pick two bolts where a line between them goes through the axle axis. You can make some sort makeshift calipers if the crank arm gets in the way.

If you have an odd number of bolts you can measure between the axle and a bolt and double it, or if the bolts are evenly spaced measure between bolts and look up the BCD on this page.

When ordering a chainring make sure you get one which has the same bolt spacing pattern, although from this page I'd say you have evenly spaced bolts.

A narrow-wide chainring may help retain the chain, but they work best with a clutch derailleur. The reason you are having  trouble in higher gears (smaller sprockets) is that the chain is under less tension. 

If you do order a narrow-wide ring, make sure it is compatible with the number of speeds of your drivetrain.