That is a great question.
Usually it does not matter, but when it does, you will get a suggestion by Josh, or another instructor, and eventually you will figure it out yourself.
Like Billy Jean, it is recommended you start with middle finger I think.
And when you play something and start using rakes, and what not, you will start to feel yourself getting tripped up, and then you start to analyze where you are getting tripped up. Often I find it is my plucking fingers, and I try starting with the other finger and seeing how that feels, and more often then not, that is enough to stop me from tripping.
And, it should be noted that most often it is not so much about the finger you start on, is is more about the finger you end up on.
So, If I play something that alternate picks, and does it on one string 7 times, and on the 8th pluck, i jump up a string, and then bounce back and forth between 2 strings for a few notes, and then end up on a 3rd string, etc…
If I start getting tripped up while bouncing back and forth between two strings, it is often because the plucking finger I landed on RIGHT before the string jump, feels off.
If I try it by STARTING on the OTHER finger, by the time I get to the string jump, I am now using a different finger then before right before I jump the string.
I try that and see if it is more comfortable or natural feeling. often I find that it is, and that is enough. So when playing that song, or that part of a song, or that part of a riff, I start making myself to be very aware of what finger I Start on at the beginning of that part, for a long time while practicing.
Before too long, it becomes 2nd nature and you don’t have to think about it.
This works for me more often then not, but sometimes, you just find a difficult part, and neither finger feels easier than the other, and it takes different approaches to tackling that lick. Sometimes I need to be counting in my head when playing certain licks, because they are hard, and only by counting in my head, can I play the right things at the right time, especially crossing strings, but the first thing I ever try is, see what finger I am on, when starting the hard part, and make sure I land on the other finger before the hard part, and amazingly, it is often enough.