A bathroom fan can stop working for a few different reasons. One reason could simply be that it has become clogged with dust and dirt. A good cleaning should fix this issue but its best not to let it build up, so a monthly cleaning would be good.
Bathrooms are very humid places, so a fan is needed to extract excess moisture. If the fan has been installed correctly, it should extract that moisture through duct work leading to the exterior of the home. If it has not, problems could arise. What do we mean by this? In some cases, the duct work has not been installed properly and does not reach to the exterior of the house, instead it might only go as far as the attic space. Is this a problem? While it might not affect the bathroom itself, it will eventually cause deterioration of attic materials and even create mold issues.
Keep your eye out for signs that your bathroom fan is not working, look for corrosion of metal fixtures, paint peeling or bubbling and, of course, excessive moisture on tiles and ceiling.
If you are concerned about whether the bathroom fan is venting to the attic, why not have it inspected? In this way you will be able to prevent those bigger problems down the road.