it takes training and conditioning, just like teaching tricks to any animal....and a lot of patience! i've been wanting to teach one of my bettas to flare when i shine a flashlight to him by holding up a mirror and shining the light at the same time, but with how much i work i'd never have time to accomplish it.
one of our bettas has learned to recognise his jar of food, and as soon as he sees it, he will "dance" back and forth, wagging his whole body like an excited puppy.
Mine does that too! only he recognizes the process i go through. I getu p open the curtain and turn the hood light off in the morning. I then open my drawers and get his container out. he goes crazy when i open the curtains and turn his light off.