The mode has nothing to do with key signature and the ending sound. Even if you know key signature and the ending, you can't tell the difference between the modes. Mode can only be judged by melody and harmonic progression's way. What is a pattern? Major mode, minor mode, court mode, Shang mode, Angle mode, demand mode, feather mode, blues mode, Lydia mode, Phrygia mode, Yugoslavia mode, etc. These are called "patterns". However, when the mode is known, it is called "tonality" according to key signature and ending, such as C natural major, A harmonic minor and so on. These are called tonality, not mode.
"You can tell by observing key signature or the voice at the end, but it's all marked by the composer." You are also wrong ... there is no composer's mark at all. The composer himself knows the mode of this work, and there is no need to mark it specially for others to know. For example, in the soundtrack of a song, you will never see such words as "major mode", "minor mode" and "pentatonic mode", will you? The composer has never marked the mode ... besides, the composer does not need to "judge" the mode. Before composing any piece of music, you must have figured out which mode to use. It is not the composer who judges what mode he has just used after finishing his work. ...
"Of course, you can also hear it with your ears" is right, because works with different modes have different styles, such as bright major modes and dim minor modes (of course, these are the most ideal situations, and we can't be so naive in practice).
As for the "what is the more essential reason" you asked, the more essential reason is the way of melody and harmony. For example, the tonic in the major mode is 1 and the tonic in the minor mode is 6, so the melody and harmony in the major mode music are centered on 1, and the melody and harmony in the minor mode music are centered on 6, which is the difference in the way of progress. For another example, in the pentatonic scale, the tonic can be 1, 2, 3, 5, 6, but no matter which tonic, the mode scale has only five tones, unlike the major mode scale, which has seven tones, so the difference in the number of tones in the scale also directly affects the way of melody and harmony. In a word, the difference of modes is ultimately the difference of melody and harmony.
As for what you said, "natural major and natural minor use the same tone, but they can produce different styles of music", this is what you just said, because the tonic is different, the tonic is the center tone, and the music always revolves around the tonic (if there is no modulation), so the difference between the tonic of major and minor is enough to make their styles completely different. For example, the scale of major mode is 1234567 1, and the scale of minor mode is 67 123456. Different scales mean that the interval relationship between the notes in the same series in the scale is different, resulting in different styles.
Finally, answer the question you asked at the beginning, "What determines the mode of a song?" Quite simply, it is decided by the composer's own will. For example, if a composer wants to create a tune with China national style, ta will use China national mode; If he wants to create a music with western style, he may use big and small modes; If he wants to create music with medieval church style, he may choose medieval mode, and so on. It is not the composer himself who needs to judge the mode type, but the students and scholars who analyze and study music works.
You can ask me more questions.