My understanding of the tonic in a given song has to do with "tonal centre" of a song. You can think of that as the place in the melody that feels like "home." Melodies take little journeys, hang out in different places, and some places feel nice and solid, and other places feel like you are hanging off the end of a cliff. When you feel like you have come "home," it often means you are on the tonic.
In songs in the major scale, we call that note "do." A song might begin on another note-- for example "I'll Fly Away." ("Some bright morning when this life is over...") Sing through the song a little bit and you'll realize that the note that feels like "home" in that song is not "Some" in the first line, it's "bright." "Some" is "mi" and "bright" is "do." The song ends on "do," which is definitely helpful in terms of figuring out that feeling of "home."
But not all songs end on "do." Think about "Four Strong Winds," to take another example. If you sing through that song to the end of a verse or a chorus (eg, "I'll look for you if I'm ever back this way..."), you will notice that it feels like you are left "hanging" at the end. That's because you are not ending on the tonic. You are ending on "so," and in fact the last chord is the chord that's built on "so," the V chord. So the song has a kind of feeling like you are left in the air at the end. That's a good sign that a song doesn't end on the tonic. ("Four Strong Winds" also doesn't begin on the tonic - the tonic is the note that you sing on the word "Winds.")
Other modes have a different relationship between the notes in the scale. The intervals in a major scale are Whole-Whole-Half-Whole-Whole-Whole-Half. Play on a piano from C to C and those are the intervals you will see. If you play from D to D instead, you get a scale that has the following intervals: Whole-Half-Whole-Whole-Whole-Half-Whole. I think that's Dorian mode, but I'm not 100% sure -- I'm not an expert on all the modes yet!
If you were singing a song in that mode, in the key of D Dorian (or whatever that mode was that I just suggested), the melody would be centred on D, just like a song based on a major scale. But the feel of the melody would be very different, because of those different intervals in the scale. And just like with a major scale, the melody might not start or end on the D note, even though D is the "tonal centre" of the melody.
And it would be similar for whatever other mode you were singing in. The term "mode" really refers to the intervals in the scale that the melody is based on. In folk music, we often use the word "modal" to indicate songs that use intervals that aren't found in the major scale, but often we aren't specifying what mode we are talking about, which makes things a little confusing.