While swimming butterfly the inhale occurs when the upper body is a the top of the wave in the body undulation, the head has been lifted out of the water and the arms are recovering to the front.
In the butterfly stroke the inhale can be done at each cycle of the body undulation, each second undulation, each third and so on. Inhaling more often avoids oxygen shortage but is more demanding as the head and chest must be lifted out of the water more often.
The best breathing pattern is really a trade-off and a matter of personal choice.
Exhaling is always done in the water, exactly like in the other swimming strokes.
Back from Swimming Butterfly - Breathing Technique to Butterfly Stroke