When a court strikes down a federal/state law or state constitution as unconstitutional, can the legislature just leave that unconstitutional provision on the statute book as long as the executive does not enforce it, or is there an obligation to repeal the unconstitutional provision? I have been reading US state constitutions recently and noticed many have provisions barring same-sex marriage, which are obviously unenforceable following the Supreme Court decisions on the matter. Can the states just leave these provisions in their constitutions indefinitely ?
No, there is no obligation to repeal
It is common for statutes held to be unconstitutional to be left on the books decades later, and for others which quite likely would be so held if anyone tried to enforce them to be similarly left for even longer periods. It is somewhat less common for state constitutional provisions, but it does happen, and as those commonly take more than a simple legislative act, there is even less motivation to go through the troublesome process in such cases.
There are even a few provisions in the US constitution which have become obsolete, but not actually amended away.
For example, the so-called 'three-fifths compromise', which counted slaves as worth 3/5ths of a person for computing representation, was effectively repealed by the Civil War and the 13th amendment, but was not formally removed. That section was actually formally replaced by the 14th.