How can you tell when flour has gone off?
Whole wheat flour goes rancid. There is a lot of fat in wheat germ and when it oxidizes the flour becomes very bitter and has a very noticeable, unpleasant scent.

First of all- if you use bleached white flour there is little to worry about. Bleached flour has had much of the wheat removed to give it a longer shelf life. At the expense of flavor and nutrition of course.

Keeping whole wheat flour out of light, sealed from oxygen, and cold will keep it from going rancid. Any one of those will extend the life of the flour- putting it in the freezer sealed from air will keep it good indefinitely.

In the cupboard I will start noticing off flavors in my fresh ground flour in a couple weeks. In the freezer I have gone as much as a year with no discernible degradation.

You will notice if it has gone bad because it will smell and taste bad. This rancidity isn't dangerous so if the flour smells and tastes fine then it is.