The main factors that keep the courts independent have to do with the lack of oversight by the people or by any elected officials. Federal judges are, of course, not elected. They are appointed by the president with the advice and consent of the Senate. That gives the people some indirect say in their selection, but once they are selected, they are completely independent. They cannot be removed from office by the elected branches unless they do something that is egregious enough to get them impeached. Their decisions with regard to constitutional law cannot be overturned by anything short of a constitutional amendment. These sorts of factors make them very independent.
There are some factors that keep them restrained. They are restrained to some degree by the need to wait for cases to come to them. They cannot go out and make laws on things like taxes but can only rule on cases that come before them. They also have no enforcement powers and must rely on the executive branch to enforce their decisions. These things keep them from having unlimited powers and make the judicial branch, in Alexander Hamilton’s words, “the least dangerous branch” of the government.