Regarding constitutional guarantees and rules related to elections and voting rights:
The relevant text of the United States Constitution, article 1, section 4 reads:
The Times, Places and Manner of holding Elections for Senators and Representatives, shall be prescribed in each State by the Legislature thereof; but the Congress may at any time by Law make or alter such Regulations, except as to the Places of chusing Senators.
The 14th amendment section 2 is also relevant
...when the right to vote at any election for the choice of electors
for President and Vice President of the United States, Representatives
in Congress, the Executive and Judicial officers of a State, or the
members of the Legislature thereof, is denied to any of the male
inhabitants of such State, being twenty-one years of age, and citizens
of the United States, or in any way abridged, except for participation
in rebellion, or other crime, the basis of representation therein
shall be reduced in the proportion which the number of such male
citizens shall bear to the whole number of male citizens twenty-one
years of age in such State.
So very simply, state legislatures have the power to oversee elections, but the US Congress has the power to step in when they see fit. Also everyone has the right to vote except for criminals. It says males, but, of course, it was later extended to women as well with the 19th amendment.
Regarding the recent court decision about gerrymandering on these constitutional protections:
In the case you're referencing, the opinions of the justices are publicly available and quite readable. One relevant section from Robert's majority opinion:
Appellants suggest that, through the Elections Clause, the Framers set
aside electoral issues such as the one before us as questions that
only Congress can resolve. See Baker, 369 U. S., at 217. We do not
agree. In two areas— one-person, one-vote and racial
gerrymandering—our cases have held that there is a role for the courts
with respect to at least some issues that could arise from a State’s
drawing of congressional districts. See Wesberry v. Sanders, 376 U. S.
1 (1964); Shaw v. Reno, 509 U. S. 630 (1993) (Shaw I ).
But the history is not irrelevant. The Framers were aware of electoral
districting problems and considered what to do about them. They
settled on a characteristic approach, assigning the issue to the state
legislatures, expressly checked and balanced by the Federal Congress.
As Alexander Hamilton explained, “it will . . . not be denied that a
discretionary power over elections ought to exist somewhere. It will,
I presume, be as readily conceded that there were only three ways in
which this power could have been reasonably modified and disposed:
that it must either have been lodged wholly in the national
legislature, or wholly in the State legislatures, or primarily in the
latter, and ultimately in the former.” The Federalist No. 59, p. 362
(C. Rossiter ed. 1961). At no point was there a suggestion that the
federal courts had a role to play. Nor was there any indication that
the Framers had ever heard of courts doing such a thing.
Here he argues that while the courts can step in clearly enumerated rights like one person one vote or racial discrimination, the courts weren't designated power to intervene in partisan political disputes over districting.
In Kagan's dissent, she argues that the 1st and 14th amendments provide protection against partisan gerrymandering, in a somewhat more abstract way.
Partisan gerrymandering operates through vote dilution—the devaluation
of one citizen’s vote as compared to others. A mapmaker draws district
lines to “pack” and “crack” voters likely to support the disfavored
party. See generally Gill v. Whitford, 585 U. S. , __– (2018)
(slip op., at 14–16). He packs supermajorities of those voters into a
relatively few districts, in numbers far greater than needed for their
preferred candidates to prevail. Then he cracks the rest across many
more districts, spreading them so thin that their candidates will not
be able to win. Whether the person is packed or cracked, his vote
carries less weight—has less consequence—than it would under a
neutrally drawn (non-partisan) map. See id., at __ (KAGAN, J.,
concurring) (slip op., at 4). In short, the mapmaker has made some
votes count for less, because they are likely to go for the other
party.
That practice implicates the Fourteenth Amendment’s Equal
Protection Clause. The Fourteenth Amendment, we long ago recognized,
“guarantees the opportunity for equal participation by all voters in
the election” of legislators. Reynolds v. Sims, 377 U. S. 533, 566
(1964). And that opportunity “can be denied by a debasement or
dilution of the weight of a citizen’s vote just as effectively as by
wholly prohibiting the free exercise of the franchise.” Id., at
555. Based on that principle, this Court in its one-personone-vote decisions prohibited creating districts with significantly different
populations. A State could not, we explained, thus “dilut[e] the
weight of votes because of place of residence.” Id., at 566. The
constitutional injury in a partisan gerrymandering case is much the
same, except that the dilution is based on party affiliation. In such
a case, too, the districters have set out to reduce the weight of
certain citizens’ votes, and thereby deprive them of their capacity to
“full[y] and effective[ly] participat[e] in the political process[].”
Id., at 565. As Justice Kennedy (in a controlling opinion) once
hypothesized: If districters declared that they were drawing a map “so
as most to burden [the votes of] Party X’s” supporters, it would
violate the Equal Protection Clause. Vieth, 541 U. S., at 312. For (in
the language of the one-person-one-vote decisions) it would infringe
those voters’ rights to “equal [electoral] participation.” Reynolds,
377 U. S., at 566; see Gray v. Sanders, 372 U. S. 368, 379–380 (1963)
(“The concept of ‘we the people’ under the Constitution visualizes no
preferred class of voters but equality among those who meet the basic
qualifications”).
And partisan gerrymandering implicates the First
Amendment too. That Amendment gives its greatest protection to
political beliefs, speech, and association. Yet partisan gerrymanders
subject certain voters to “disfavored treatment”—again, counting their
votes for less— precisely because of “their voting history [and] their
expression of political views.” Vieth, 541 U. S., at 314 (opinion of
Kennedy, J.). And added to that strictly personal harm is an
associational one. Representative democracy is “unimaginable without
the ability of citizens to band together in [support of] candidates
who espouse their political views.” California Democratic Party v.
Jones, 530 U. S. 567, 574 (2000). By diluting the votes of certain
citizens, the State frustrates their efforts to translate those
affiliations into political effectiveness. See Gill, 585 U. S., at ___
(KAGAN, J., concurring) (slip op., at 9) (“Members of the disfavored
party[,] deprived of their natural political strength[,] may face
difficulties fundraising, registering voters, [and] eventually
accomplishing their policy objectives”). In both those ways, partisan gerrymanders
of the kind we confront here undermine the protections of “democracy
embodied in the First Amendment.” Elrod v. Burns, 427 U. S. 347, 357
(1976) (internal quotation marks omitted).