Good question. I will say up front that I am not going to provide the most satisfactory answer here for lack of sufficient time and space to dig in in a way that does the question justice. And because a lot of this hinges on election, which is a conversation in itself.
The shorthand response is that those God has elected before the ages began, he calls, and they are compelled by his gracious call to respond in faith and repentance. Not all those who hear the call of Christ respond in faith. That is not an argument against iridistible grace but rather a confirmation that salvation is tied to election.
Judas showed by his fruit that he never truly believed, which means he was not elect. He *responded* to the call to follow Christ but we see even before his betrayal that he never truly turned from his sin. Peter, by contrast, does deny Jesus but his repentance is one among many evidences that, unlike Judas, he is among the elect. You shall know them by their fruit.
The sewer and the seeds parable is one instructive place in the Scriptures to help illustrate these points.
The Canons of Dort are instructive as well, particularly Article 8 and onward.