How does the court get personal jurisdiction over the parties in a lawsuit?
Generally, in civil cases, the person who is filing the court case (the plaintiff or petitioner) is giving the court jurisdiction over him/herself by just filing. When you file a court case in which you are asking for a relief from a court, you are telling the court that there is an issue you need the judge to address and that you will be bound by whatever decision s/he reaches. That means that you are agreeing that the court has the power or authority to make a decision that affects you (personal jurisdiction).
It is a little more complicated when discussing the person you are filing a lawsuit against (the defendant or respondent.) Our biggest law (the U.S. Constitution) wants to make sure that a defendant in a case has an opportunity to defend him/herself if a lawsuit is filed against him/her. To make sure s/he can defend him/herself, the plaintiff or the court system needs to notify the defendant of the lawsuit or complaint against him/her. Each state has its own laws in terms of what needs to be done in order to legally notify someone of the action against him/her and if that is to be done by the plaintiff or by the court. If the defendant resides in the state where the court case is filed, once the defendant has been legally notified, the court gets personal jurisdiction over that party and can now start the legal process. It is more complicated if the defendant lives in a different state than where the lawsuit was filed.
Note: In most states, if you file a court case against someone who lives out of state and that party comes to court (makes an appearance), s/he must raise the lack of personal jurisdiction as a defense before or during the first court appearance. If all parties appear and no one tells the judge that the court does not have personal jurisdiction over the out-of-state defendant, then the judge will likely let the case continue.