You can speak French without a mistake and still write the very same sentence wrong. There is one letter that disappears to the ear but jumps straight out at a French reader. How do you check for something you cannot hear?
The choice between the two auxiliaries is no mere matter of which word appears. When the auxiliary is être, the past form of the verb agrees with whoever performs — in gender and number. And when it is avoir, it does not change at all in most cases.
Who performs
With être
With avoir
One man
il est allé
il a mangé
One woman
elle est allée
elle a mangé
Men
ils sont allés
ils ont mangé
Women
elles sont allées
elles ont mangé
The central example
When the agreement is heard
allé and allée sound identical.
The difference exists in writing alone.
But in a verb ending in a silent consonant, the e sets it working.
And then the difference is clear to the ear.
With être, agree in gender and number with the subject; with avoir, in most cases, do not.