As an example, both the spellcaster and the opponent ("the archer") have 1 hp remaining, so whoever completes their action first will knock the opponent unconscious. The spellcaster casts Create Bonfire on the archer's space. However the archer has readied an arrow targeting the spellcaster for "as soon as the spellcaster is visible."
My question is, whose action will go off first?
The relevant information on concentration can be found in the PHB (p.203):
You lose concentration when you cast another spell that requires concentration. You can't concentrate on two spells at once.
and XGtE (p.5):
As soon as you start casting a spell or using a special ability that requires concentration, your concentration on another effect ends instantly.
Readied actions can be seen in the PHB (p.193):
When the trigger occurs, you can either take your reaction right after the trigger finishes or ignore the trigger. Remember that you can take only one reaction per round.
From this, it seems unclear who will complete their action first. What counts as the archer's trigger finishing? Does it finish when the spellcaster finishes casting their spell, as this action is what began the trigger? Or does the archer get to fire their arrow as soon as the spellcaster is visible, as they "finish" being invisible as soon as they begin casting the second spell?
Best Answer
The spellcaster wins
Since invisibility ends as soon as the spellcaster begins casting the archer takes their reaction at the same time as the spellcaster is casting the spell. The archer's readied action and the spellcaster's casting of Bonfire occur simultaneously
Xanathar's Guide to Everything (p. 77) offers the following rule regarding simultaneous effects:
Since it is the spellcaster's turn they can choose to have the Bonfire be cast before the archer makes their attack. As such the spellcaster wins.
If a DM wanted to be kinder to the archer they could have a Dexterity Check to let the archer shoot faster than the spellcaster finishes casting but this would not be RAW.