Background Image Does Not Display on Page

Based on what’s provided I would suggest doing some var_dump tests on the $bg variable, it would seem that the ternary logic there is equating to false and thus nothing is being assigned to the $bg variable.

Do you have a default background image, if the $bgimage field is not set by a user?

Also, be sure to check the spelling of what you set up in ACF field names, I’ve had situations like this where ACF content wasn’t showing up and the issue was a rogue space in the field name or a misspelled field name.