The short answer is that no one thought to include such provisions in the United States Constitution that was adopted in 1789, and that it is very hard to amend the United States Constitution (although one amendment that partially addresses this concern, the 25th, has been adopted).
This is understandable. Dementia at an advanced age was a significantly less salient issue in 1789, when life expectancies were much shorter, than they are today. The average life expectancy in the time period from 1750 to 1800 was 36 years. Even conditional upon attaining age 20, the life expectancy for white men was under 50 years of age, throughout the 1800s. Most people died before they were old enough for age related dementia to be a major concern.
Federal Elected Officials
The upper age limit for serving as U.S. President is eight years older than the candidate was when he was elected, with voter review after four years. If the voters elect someone, they do so with the understanding that the President will serve at least another four years and evaluate for themselves if that is too old. In practice, age is frequently raised as an issue in the Presidential nomination process and in Presidential elections, although it is hard to identify a particular election in which it was a decisive factor.
The same thing happens in every legislative election.
Also, the 25th Amendment to the United States Constitution was adopted to address the question of Presidential incapacity, and federal legislators can be removed by the house in which they were elected for cause by a two-thirds majority (U.S. Constitution, Article I, Section 5, Clause 2).
In the case of judges, there is only the remedy of impeachment for non-feasance resulting from failure to carry out the duties of the office as a consequence of old age related conditions. But, the compensation system for federal judges in the United States creates a very powerful economic incentive to retire at a reasonable retirement age by virtue of how the defined benefit pension plan works, that most judges assent to not long after reaching that age. As explained in the linked material:
Financial concerns were paramount for judges who retired after senior
status, as well as for judges who retired directly from active
service, according to the survey results presented on Sunday. “I
wanted more income” was the most popular reason cited for retirement
for both groups. . . .
Federal judges can retire or take senior status, with the option of a
reduced workload, if they satisfy the “rule of 80.” The requirement
says they must be age 65 or older, and their combined age and years of
experience must total 80. It is an attractive option because their pay
remains the same, but their taxes fall because they don’t have to pay
taxes for Social Security or Medicare.
In other words, if judges retire once meeting the "rule of 80" they can get the same pay with less taxes without doing any work, and can take senior judge assignments in the discretion of the chief judge of their court for additional pay, while vacating their position. If a chief judge feels that a senior judge is no longer intellectually able to do the work, the chief judge can decline to assign a senior judge to more cases.
Only at the U.S. Supreme Court level is the power associated with holding the post so great relative to financial considerations, that the compensation system incentives don't work, and it is arguable that in the case, for example, of Justice O'Connor, that the compensation factor was an important reason for her resignation.
The concern is also mitigated at the U.S. Supreme Court level, and even at the Court of Appeals level, because those judges mostly make decisions as part of a panel of judges, rather than individually. So, if the other judges on the panel make the right decision, the incompetent judge's decision doesn't matter.
For trial court judges, the prospect of appellate review of their decisions partially mitigates the risk of a judge making bad decisions due to declining intellectual capacity.
State and Local Age Limits And Disability Rules
Most states have chosen not to follow the federal example with regard to judges and have either imposed a constitutional retirement age, as in the case of Colorado, where Colorado Constitution, Article IV, Section 23(1) requires judges to retire at age 72, and/or have a commission overseeing judges (and sometimes other civil servants) that can require them to retire due to disabilities which often arise from old age.
Term limits, which are common at the state and local government level, also often impose de facto age limits, because most very elderly elected officials mandated to be so old by being re-elected many times after being first elected at a much younger age. Term limits limit the extent to which this can happen.