Do not forget that the general category of “bears” includes black bears and grizzly bears. Black bears are omnivores with few predatory inclinations. Grizzly bears are generally much more predatory. (Indeed there was a study about grizzly’s predating on blacks in Yellowstone.)
These are two different animals with two different behaviors. Size plays into it. A Grizzly bear is generally much larger at around 450lb for an average male. The average for a black is around 240.
Here in the NE corner of the US, all we have is black bears. Except when habituated to people, black bears will move away from an average sized adult. Of course, this does not include mothers with cubs. In most cases, you simply want to look big. That is as big as the bear and he will recognize the potential for his own damage if he attacks. A Grizzly bear will simply not care about a 200pound human and can attack him easily.
Both are opportunists. If they find food, they will eat it. A black usually grubs, and eats things like berries. If he finds a dead or injured animal, he will eat it. A grizzly will attack and probably eat anything that comes within his reach.
While I cannot say for sure, I believe that bears can smell food when hauled up a tree. They know what it is, where it is, the various types of food in the bag and how much is in it, by smell. Some foodstuffs they recognize. A black bear will generally not bother with well hung food. Too much effort. But pictures of bears crossing lines, hand over hand like a human, to get at bird feeders are common. A bear, like most other predators, will usually ignore things he cannot catch, but, he is NOT above grabbing it if he can. Of course, there is the “trained” bears of Yosemite that subsist on people food and work to improve their knowledge of getting it. (Not quite true, but not really a joke…)
A lot will depend on how the bear is doing at foraging. If he finds something to eat every time he looks (it is just a matter turning over a log to get worms, grubs, and salimanders, etc) he won’t bother to exert himself. You food will be safe. If he is hungry, he will be much more aggressive and spend time and effort trying to get a hung bag. If he smells food in a tent because he is hungry and opens it up, and finds a person in it, he could well attack that person. (People are only another animal in the woods.) A grizzly is especially prone to this. Most blacks would simply run off.
So, in lean years, bears are much more aggressive. But, I have always hung my bag on a limb the bear cannot climb and is not strong enough to support a bear and they cannot reach. They certainly do not want to fall and injure themselves. This is simply self preservation. It helps to move the line to another tree, also.
So, getting back to your basic question, bears are generally not nocturnal. They are not all that active at night except during a good bright moon. Generally, there are simply no bears around. In the case a bear does come by, it is too much effort to figure out or climb the tree or find the line & chew it if he is not all that hungry. But, if he wants it, he certainly can get it. Even bear canisters are not 100%. And ursacks and the like can easily become a masticated mess since some liquids can leak out. Sleeping with your food is not recommended, but people did that for many years. Hanging or canisters or ursacks are only a deterrent. They never stop a bear. All you can say is they will slow him down to the point of frustration…he moves on to easier pickings.
Just make it difficult enough for the bear, and he won’t bother your food bag. But, once he has gotten one, he WILL come back for more. Do not ever be sloppy, because the next camper may pay the price. Besides saving the bear, since nuisance bears are often killed. You save both your food, yourself and the bear with a good hang or by using a canister.