Custody Question

So how will the courts go about custody when each parent will be living in a different state? Anyone been through this before?