Well, this is definitely a major can of worms. And it would be most easy to tick a wide variety of people off by any sort of flip answer.
Okay, first you have the First Amendment right to freedom of association. This means that, other things being equal, you have the right to associate with whomever it pleases both/all of you to hang out with, and to avoid associating with those whom you prefer not to. This is your right as a private individual. And it is, by obvious extension, the right of private organizations made up of private individuals to pick and choose, on a reasonable basis, who may or may not be members. There are some “hedges” on this that would require a good constitutional lawyer to decipher. For example, a fraternal organization may not act to exclude African Americans en masse.
A fully public organization, such as a school district, is very delimited in whom it may exclude. A student who is demonstrably disruptive can be excluded on a one-by-one basis, for example, but case after case has stressed that no segregatory or exclusionary action that is not clearly based in the need to provide an education to the children attending is legal. A political party may not exclude anyone who asserts his good faith desire to be a member of it.
And case law to date has held that if you accept public funding, you become “painted” with a public character, and must follow the highly restrictive “public” rules on membership. The American Legion, for example, functions in many states in a quasi-public role and is, where legal, the recipient of public moneys for various civic and charitable activities. And it is required to admit any veteran or member of a veteran’s family, assuming that no reasonable cause to exclude pertains. (E.g., a man who fought in World War II and then was convicted of spying for the Russians, served his term in jail and was released, and then applied for membership, might be justly scrutinized to decide whether he has, so to speak, repented of his quasi-treasonous activities. But that a veteran’s son is a member of the Socialist Party is not sufficent grounds to exclude him if he has a mind to join.)
Now, what the Supreme Court decided is that the Boy Scouts of America, notwithstanding any public funds that may or may have not been devoted to their activities, constitute a “private” organization and can specify who may be a member, leader, etc. They may thus exclude gays from leadership roles, atheists from being members, etc.
I personally disagree with the Court’s holding; I feel that as the single group providing “Scouting” experience to boys and the recipient of at minimum in-kind provision from public groups (ranging from the U.S. Army to various cities and towns), they are “tinged with a public nature.” However, what the courts decide is the law of the land.
Please take note that one can agree with the Court without being homophobic. The question is not whether the Scouts ought or ought not admit gays to membership or leadership roles, but whether they have a legal right to decide whether or not to do so. The courts held that they do have that right. And, unfortunately, they are using it in a highly discriminatory fashion.