Generally an official will let you know when you're in violation of the centerline rule and also let you know if you get a warning, a relegation, or DQ'd. It isn't always possible or safe for the official to let you know right at the time of the violation. For example on a winding or hilly road, it wouldn't be too smart for the official to drive next to the pack in their car on the wrong side of the line, just to give you a warning. Sometimes a honk of the horn from the official serves as a warning. (although I've seen it done unfortunately). Like Shovelhd said, the motos refs are much better at enforcing the rule and giving riders notice of centerline violations.
The "centerline rule" is enforced differently in different areas. Officials are stricter in areas with higher automobile traffic, a history of complaints from the general public, or a history of centerline violations leading to injuries. I was told that last summer a rider who was over the centerline was hit by an oncoming truck. I was wondering if this will mean that officials, especially over in the Seattle area, will have to be stricter about the rule in response from pressure from the state DOT. We'll see.