How and where to breathe on the ocarina
Your lungs basically function as an air tank, and how full they are determines how long you can play for before you run out of air. We want to keep our lungs full by both breathing as quickly as possible, and looking for opportunities to take breaths.
First, we always breathe through the mouth, never the nose. The reason is easy to see if you try rapidly inhaling through your mouth, and then the nose. Breathing through the mouth is both faster and less noisy as it offers a much larger air passage.
Its also important to fully open the airway, and that can be done by thinking of the sound 'Hoh', as you inhale. Regardless of the duration of an exhalation, we always want to breathe in as quickly as possible:
- Inhale as fast as you can, and then let out that inhalation as slowly as you can. When we play ocarina, we want to maximise the duration of the notes, and minimise the duration of our breaths.
- Practice doing this with various rates of exhalation. Exhale slowly, and then breathe in. Exhale rapidly and breathe in. Try to make the inhalation duration the same in all cases.
And try applying that to the ocarina. Play some long tones on one note, and when you're about to run out of air, open the mouth, inhale rapidly leaving the ocarina's mouthpiece in place, and play another long note.

There are a few different ways of knowing when / where you can breathe that is musically appropriate. First, if you are playing from sheet music is to look if the notation includes breath marks. These look like a comma, and indicate that a note can be shortened to let you take a breath.

The equivalent if you're playing by ear is to listen for where the player you're copying is breathing.
A second approach involves recognising the phrasing of the music. In songs, the end of phrases are where a singer would add a pause or take a breath. Take the following part of 'The ash grove', for example:

In my opinion, this song is formed from three phrases, two short ones at a long one. The song has a pick up note or 'anacrusis', which has shifted the end of the phrase relative to the bar line. The final note of line 1 bar 3 is the start of phrase 2.
We can take a breath at the end of these phrases by shortening the last note, or in some cases by adding a rhythmic pause, called a fermata.

If you want to play a song, listen to several people sing it. Pay attention to where the singers take breaths and replicate them in your own playing.
Note that, while the melody often repeats unchanged through the different verses and choruses, there are often subtle changes in the rhythm and phrasing. You may or may not wish to replicate this in an instrumental rendition.
Stepping the breath
Sometimes music does not offer the time to take a full breath, in very rhythmically 'dense' music such as Irish dance tunes and a lot of classical music, a long breath can sound jarring.
A different approach to breathing is to taking many small breaths and never allowing ourself to fully run out of air. To begin, let's give that a try without the ocarina:
- Take a full breath.
- Breathe out only a little, perhaps 10 percent of your capacity, then refill the tank.
- Continue, varying how much you exhale and inhale.

Opportunities to take breaths in this way can include short staccato notes and rests. It's also possible to shorten a longer note.

A common approach among players of traditional Irish music is to drop an off-beat note, usually somewhere around the end of a phrase. The structure of this music is very regular, usually consisting of 2 bar phrases, since it is written to carry a rhythm for dancing.
Here is the first part of the Kesh Jig for example:

And this is how it breaks into phrases. Note the rests, which indicate breath points:

We don't usually drop the last note in a phrase as these melodies tend to be written so that phrases flow directly together melodically. Placing breaths on weak beats sounds more idiomatic.
Breaths can also be hidden by varying where breaths are placed in repeated parts of the melody.
Different traditions will have their own tendencies for what makes idiomatic breathing, and it's worth doing some research.
Closing notes
It's always a good idea to study the breathing habits of experienced players, of ocarina and other wind instruments, to develop an awareness of where breaths can be placed musically.