This question has many facets in it and may be a little intermingled in it explication for some, but I will give it my best effort possible.
Let us start by stating who (which priests) can say Mass.
Can. 905 §1. A priest is not permitted to celebrate the Eucharist more than once a day except in cases where the law permits him to celebrate or concelebrate more than once on the same day.
§2. If there is a shortage of priests, the local ordinary can allow priests to celebrate twice a day for a just cause, or if pastoral necessity requires it, even three times on Sundays and holy days of obligation.
Can. 906 Except for a just and reasonable cause, a priest is not to celebrate the eucharistic sacrifice without the participation of at least some member of the faithful. - The Ministers of the Most Holy Eucharist
How do religious priests (Benedictines, Dominicans and so on) know who is going to be the Main Celebrant at Mass?
For priests of Religious Orders this question is quite simple.
Priests of Religious Orders take turns being the Main Celebrant at Mass. Each week a different priest has a turn at being the hebdomidarian. This liturgical function starts at Matins on Sunday morning and concludes at compline on Saturday evening. Priests will take turns as being the weekly hebdomidarian by order of rank and seniority. For example the prior will be the Main Celebrant one week and then followed by the sub-prior, who in turn would be followed by priests according to their date of solemn professions.
The Hebdomidarian will, in addition to being the Main celebrant at Mass, will also perform the liturgical duties laid down in the Collectarium. Benedictine abbots will be the Main Celebrants at High Masses like Christmas, Easter, Pentecost, Annunciation, Assumption and so on. They will also be the Main Celebrant at the funeral of one of their community. If the abbot is impeded for some reason, the prior will take his place.
The Collectarium, a book for the use of the hebdomidarian, which contained the texts and the notes for the prayers, chapters, and blessings. - Wikipedia
As for the liturgical life in a particular diocese, the Bishop would normally be the Main Celebrant at a concelebrated Mass, but not always. When the local bishop is present at Mass, he is the Presider of the Mass. The bishop will not concelebrate Mass as a concelebrant in his own diocese unless there is one of greater rank present than himself, such as the pope.
There are several occasions when the diocesan bishop could participate in Mass without concelebrating. For example, if a bishop attends a Mass celebrating a priest's jubilee anniversary, or a funeral for a priest's parent, he will often not concelebrate because the bishop would have the obligation to preside at the Mass.
"The liturgical norm in force, which carries with it a theological principle rooted in the wisdom of the Fathers, confirms with all evidence the necessity that the Bishop preside at the celebration, whether he celebrates the Eucharist or not.
"The Ceremonial of Bishops in n. 18 says 'In every community of the altar gathered together under the Bishop as its sacred minister, the symbol of that charity and unity of the mystical Body, without which there can be no salvation, is shown. It is most fitting, therefore, that when the Bishop is present at a particular liturgical action, where the people is gathered, that he, as the one signed with the fullness of the sacrament of Order, presides at the celebration. This is not done to increase the exterior solemnity of the rite but to signify in a more vivid light the mystery of the Church. It is fitting also that the Bishop should join presbyters with himself in the celebration. If, however, the Bishop presides at the Eucharist but does not celebrate it, he himself takes charge of the liturgy of the word and concludes the Mass with the rite of dismissal.' - When a Bishop Doesn't Concelebrate at a Mass
In parishes the Main Celebrant of the Eucharist is generally the parish priest as he is the highest ranking priest in charge of the salvation of all the souls in the parish. This privilege may be deferred to a different priest for a number of reasons, such as marriages, funerals, silver anniversaries of priesthood and so on.