Obviously inspired by current events, but lets keep this off of that. Sometimes the SC issues very broad rulings striking down whole laws and sometimes they issue very narrow ones regarding the specific case. So what happens when a majority justices have the same ruling but not the reason why? Lets say in a hypothetical case of Smith vs. State, three justices say State is right, three justices say Smith is right and the law against him was completely unconstitutional, and three justices say Smith is right but only in the very specific set of circumstances in the case and there’s nothing wrong with the law. How is the final decision made and written?
You can have a “concurring” opinion, where you concur in part and dissent in part.
There are a number of different scenarios and it gets complicated. In your example, let’s say that 6 justices agree on the judgment of the case–the judgment needs to have a majority opinion to overturn a lower court ruling. That judgment might mean that the lower court’s ruling is overruled or upheld.
For binding precedent to emerge from that judgment you need an opinion that can establish precedent. This is where it gets complicated, if a majority agrees on the written opinion, that opinion is binding precedent. But what if there are 6 justices who agree on the outcome of the case, but 3 support Opinion A, 2 support opinion B and 1 supports Opinion C?
Under the Marks rule, so named for the 1977 Supreme Court case of the same name, the controlling opinion is the part of the opinion that the most justices agreed on the narrowest grounds. So essentially for a lower court to work out the murk of what is precedential in our hypothetical, they would have to look at all of the concurring opinions, A, B and C, and delve from that "what opinion across these three had the concurrence on the narrowest grounds.) In that case the plurality opinion, Opinion A, does not necessarily control, but rather it could be a portion of agreement between A and B ends up being precedential.
It gets muddied because lower courts can and actually do use opinions that aren’t controlling as the basis for other future decisions, they usually won’t do so if it directly contradicts established precedent, but the law is messy and often times a specific case may hinge on a new area of law, so sometimes different parts of these messy decisions will come up in later cases.
Some SCOTUS pundits advocate for abolishing the Marks rule and simply requiring any precedential opinion have a majority of the justices, because there are interpretational issues for lower courts in making out the muck of some of these contentious plurality opinions, but at present that’s the state of the law.
I will add that sometimes you can have less than five sign on to a single opinion but still have a “majority opinion” on the narrowest grounds principle. E.g. 5 justices vote for a certain outcome, only 4 concur on the opinion and the 5th writes his or her own concurring opinion. But parts of that concurring opinion agree with parts of the plurality opinion–those overlapping parts actually constitute a majority opinion even though only four justices technically signed on to the four signee opinion.