It occurred to me that I couldn't think of a Senator or governor who was elected president, then went back to run for their prior office after their term or terms were up. Has this ever happened? If not, is there a law or precedent preventing it, or is it simply that no one wants to after attaining the highest office in the land?
John Quincy Adams served as a Senator, Secretary of State, and Ambassador to multiple European States prior to being President.
Afterwards he then was elected to the House of Representatives where he served 17 years until his death, becoming one of the leading anti slavery voices whilst there.
President Taft would go on to join the supreme court, and would even become Cheif Justice. While you don't "run for office" for supreme court, this is the highest position held by any former president.
There is (arguably) a Constitutional prohibition against term-limited Presidents being elected Vice President, but none limiting them from holding other office.
Many Presidents have left office notably old and unfirm, or sufficiently unpopular that any resumed electoral career would have uncertain prospects; the minor benefit of resuming lower elected office being well-outweighed by the risk of embarrassment of being denied it having lost office. (Don't forget that Theodore Roosevelt ran for President again in 1912, losing, and Gerald Ford came close to running for President again in 1980.)
Former Vice Presidents have regularly held or sought other office. In relatively recent examples, Walter Mondale ran unsuccessfully for the US Senate. Hubert Humphrey returned to the US Senate. Richard Nixon ran unsuccessfully for Governor of California after he was Vice President and before he became President. George Wallace was given a cabinet seat in consolation from being denied re-nomination as Vice President.