While swimming butterfly, breathing is initiated by kicking a little bit harder during the second dolphin kick. This makes your upper body rise a little bit higher above the water surface during the body undulation. Inhaling occurs as soon as the mouth clears the water and the arms start their recovery forward.
To avoid straining the neck and to keep a steady rhythm, it is best to keep a neutral head position while breathing in. Try to look downward and only a little bit forward rather than toward the end of the lane.
Exhaling starts as soon as the head drops back into the water and continues until the head and shoulders rise above the water surface again during the next breathing stroke cycle.
Not every stroke cycle needs to be a breathing one. A common trade-off used while swimming butterfly is to have a breathing stroke cycle followed by a non-breathing one. This is generally considered a good trade-off between the need of consuming oxygen and the increased effort necessary to lift the head and shoulders higher above the water surface.
However, depending on the ability of the swimmer to maintain good rhythm and speed during breathing stroke cycles and also depending on the length of the race, breathing stroke cycles can be added or reduced.
For example, you might breathe less often at the beginning of the race to swim faster and then breathe more often later when your body needs more oxygen.
Some experimentation might be necessary to find the optimal trade-off for each individual swimmer and race length. That being said, top-level swimmers are often able to breathe every stroke cycle without losing speed.
Breathing to the Side
Some butterfly swimmers turn their head sideways to inhale. The idea is that it allows them to keep their head closer to the water surface and less energy is used to lift the head and shoulders above the water surface.
However, more amplitude in the body wave is not necessarily a bad thing. When the chest move downwards in the water it transforms the vertical movement in a forward momentum. So additional amplitude in the body undulation might also translate into more forward momentum and increased velocity.
Furthermore, turning your head sideways to breathe increases the strain on the neck and also often disrupts the symmetry of the stroke.