Long distance relationships are notoriously difficult to maintain, even under the best of circumstances. That said, you need a few ingredients.
First, you have to have some kind of end game. Long distance can’t just go on and on with no end in sight. You have to have a plan to be together after X amount of time. And it has to be a realistic plan. One of you has to move to be near (or live with) the other one.
Second, you need to have plenty of money for travel. Even if it’s just a few hours driving distance between you, that will mean the cost of gas, or train, or bus fare. If it’s further away, you will need money for plane fare.
Third, you have to both have compatible time off to be able to visit with each other. Maybe your significant other has weekends off, but you usually have to work weekends. So, how are you going to make it work? Will you both get vacation time for holidays? You have to evaluate your schedules, and see how likely it is that there will be time to spend at least a weekend together every so often. And along those lines, are you both on the same page as to how often you need to see each other to keep the relationship going
Fourth, you need to have a lot of trust in each other. Do you have an agreement that when you’re apart you’re free to date others? Or do you both expect faithfulness and monogamy? You need to be on the same page about this too. Of course if you both agree that it’s OK to date others while you’re apart, there’s the risk that either of you might meet someone else you like better. That’s a huge risk of a long-distance relationship. Even if you plan to stay faithful to each other, things happen. Plus there’s the loneliness factor. It can be really tempting to seek out comfort with someone else, just because it’s been so long since you’ve seen your significant other. Or because you were planning a visit with your S.O. but then something came up, and the plans had to be cancelled.
Fifth, you need a lot of patience. Especially if it’s going to take a lot of time before you can be together. And you’re going to have to have patience to endure all the time, effort and inconveniences of traveling back and forth in the meantime.
If you don’t know each other very well, it’s not a good idea to start up a long-distance connection. It takes time to get to know someone. And by that I mean, time spent with each other in person. If you’ve met this person online, and they live too far away to get together casually, you have to rely on emails, texts, Skype, etc. to get to know them. And that is really not adequate. No matter how much it feels like you have a real “connection” between you, it’s way too easy to hide things from people you only communicate with online. You may be shocked to discover (when you finally meet this person face-to-face) that they are nothing like what you expected. And they may have lied about their life circumstances. Or their age. Or their job. Or anything else.
Just do not attempt to do a long-distance relationship with someone you’ve met online, but do not know in person. If they live too far away for you to just meet up for coffee, don’t pursue it. Look for someone who lives in your own area, that you can see regularly to explore whether you are compatible. Otherwise, you may waste a lot of time, and emotional entanglement, in communicating with someone you get your hopes up about, and they turn out not to be what you expected.
Relationships are built a little at a time, shared experience upon shared experience. There are numerous little things that go into getting to know each other, and determining that you have similar values, goals, beliefs, etc. You need regular, in-person contact to develop your relationship. And even if you have had lots of time to get to know each other in person, and then one of you has to go away to go to school, or take a job somewhere far away, etc. it can be really difficult to hold onto your relationship from a long distance. Even if nobody else comes into the picture, you still might just grow apart, with your separate lives putting you through separate changes.
I think your best chance for maintaining a long-distance relationship is if you know each other really well beforehand, and the long distance between you will only be for a relatively short time.