Lots of small things can go wrong. In theory, you can replace every part of the fixture. In practice, IMO, anything other than replacing the tube is generally not worth it; get a new fixture.

Moisture in a bathroom can corrode contacts at an accelerated rate. It doesn't take much to make a fluorescent "fussy."

The first thing I'd do: remove the tube, and gently check the pins at both ends for "wiggle" or corrosion. If it seems okay, turn the tube end for end; then install it, and very carefully rotate a full 360 a couple of times. This may clean the contacts enough to get a reliable connection.

The next move is to replace the tube. Sometimes they go wonky without much external indication.