1) Marry the right person. You need to get to know the person before you sign a document entitling them to half of everything you are and do. You need to spend time with them. You need to fall in love with them. You need to move in together and live with them. You ABSOLUTELY need to "try them out" first. Fuck your family, your friends, your religion... All that "why buy the cow" talk is bullshit. You want to spend the next WHOLE REST OF YOUR LIFE with someone, with a penalty of losing half (or more) of everything you have if you can't hack it? Do the homework. Get to know them. Loving isn't fancy warm feelings and fucking a lot. Love is acceptance, and you really need to know what it is you're about to accept. And that's where we get to...
2) Nobody is perfect -- not even the perfect person for you. Every. Single. Person. On this planet has issues. There's no getting around it. Now, some issues aren't issues to you. Some issues are cute, endearing, or just flat out don't register. My wife adores animals to the point she's committed her life to them. I adore this. But then, there's issues that are hang ups or big deals. Those you have to work with, on both sides. You have to be willing to talk to them about it and ask them if they can change... And you have to be willing to accept that, sometimes, the answer will be "no." And on the same note, you have to be willing to change the things you can, and you MUST be honest with the things you can't or just don't want to. Give them all the information they need to make a good decision.
No one I have ever seen, heard or read has ever put this better than Dan Savage in his talk on "The Price of Admission":
There you go. The only two secrets to being married for a long, long time. It really is that simple. Get to know who it is you are marrying, and be willing to accept who they are -- and be honest about the things you can't accept. That's really all it takes.
Now, there's life events that will occur. Times will be hard. There will be good times and there will be bad times, and then there will be REALLY bad times. I can't coach you through any of those, and I'm not really willing to share stories of ours. Because they're our stories. They made us who we are today, which is magnificent and amazing.
What I can say though -- if you have done the above two things, you have all the tools you need to weather any storm. It's like a workshop. Rather than give you plans on how to build a table or a bookshelf or a decorative birdhouse, I'd rather give you the drill, the table saw, the screwdrivers and glue and say "this is all you need. Go."