Most people who come out generally do so because being closeted to friends and family becomes intolerable. For some, it reaches a crisis point that resolves with finally letting go. Others share similar or different experiences. For me, it was deciding that I would rather endure rejection with coming out over the pain I was in at the time. Once I had that internal resolve that I must come out no matter the consequences, it then only took the momentary courage to spit it out. Confidence can only come from experience. It's how we reach confidence with anything we do - by experience and practice. You will gain confidence in coming out the more you come out. But, yeah, the first few are much more difficult. Simply put, you have to screw up your courage, and jump. There really is no other way. But once done, it gets easier and easier each time you tell someone that you're gay. I now tell people with ease, though everyone who knows me IRL pretty much already knows. Take care.
In my case, I made sure to have the right kind of friends. You realize about this by listening to them and getting an idea of how they see the world. For example, I noticed my friends were quite open about religion or they even had other gay friends. That's when you notice they are a safe place to begin with. Familiy is usually not that easy, but you have to realize that If your familiy is not gonna support you above all things, they don't deserve to be called your familiy, so If they reject you or something, be sure to have a good group of friends who will be with you through those though times.