I think the best way to go about it is to privately sit down your most supportive family member or friend, the one who is most likely to fully accept and embrace you with open arms, and be completely honest with them. Just talk to them one-on-one privately and come right out with it, "I have something to tell you- I'm gay." It's important that you have a support group with someone or a group of people who love you unconditionally and who can help you feel supported so that you are more at ease and have someone to turn to in the case that perhaps you don't get the response you were looking for. You have nothing to be ashamed about and there is nothing wrong with you and you are not going to let anyone down. Anyone who makes you feel upset or lashes out against you is not someone that you need in your life.
Any of those "friends" you have that wouldn't want to hang out with you or have anything to do with you are not your friends. Because you are gay and it's not a choice, it is simply who you are. Anyone who truly decides not to still be your friend is someone that you will be better off without in your life. Honestly, I'm going to assume you are young (under 18) and in school. Generally, most schools (especially high schools) should have an LGBT+ group or club where you can come out and feel supported and around other young teens who are going through the same things you are. It also may help you if you find people online to talk to in similar situations.
That being said, once you have that friend/family member or group of friends who know the truth and you feel supported and confident, I would sit down your parents privately and tell them the truth. There's really no better way than just being completely honest, open, and vulnerable. If your parents are good parents who truly love you, they will except you exactly the way that you are. And lastly, about the grandkids thing, you still could have grandkids! Adoption is a viable option in the case that you would like to have children once you are older and ready.
Good luck OP and I hope that things work out for you. xx