The Doctrine of Pre-emption and The Supremacy Clause
The law that applies to situations where state and federal laws disagree is called the supremacy clause, which is part of article VI of the Constitution [source: FindLaw]. The supremacy cause contains what's known as the doctrine of pre-emption, which says that the federal government wins in the case of conflicting legislation. Basically, if a federal and state law contradict, then when you're in the state you can follow the state law, but the fed can decide to stop you.
The operative term here, though, is "can."
Arizona's immigration law is a great example of the federal government fully enforcing the supremacy clause. When Arizona passed a very strict immigration law, the federal Justice Department sued them to overturn it under the supremacy clause. A spokesman from the Obama administration stated that the reason it went after Arizona is that the state law had international implications, especially in Mexico and the rest of Latin America. Proponents of the Arizona law said that the state was just enforcing federal law, since the feds would not do it and illegal immigrants were costing Arizona a lot of money. The case went all the way to the U.S. Supreme Court, where the Court overturned parts of the law and upheld others [source: Cohen]. Nevertheless, officials at the Department of Homeland Security said due to limited resources, it was not likely to step into illegal immigrant cases except high priority ones like those involving felonies [sources: Archibold, Cohen].
Historically, the federal government has not cracked down every single time a state and federal law contradict. If state law contradicts federal law but it's not something that affects national security or international relations, the fed might not intervene. In Nevada, certain counties have legalized prostitution, which also violates federal law, but the federal government has so far not enforced the doctrine of pre-emption in Nevada. Prostitution is illegal according to U.S. federal law, but under Nevada state law, counties with a population of less than 700,000 people can legally have legal brothels [source: Tan]. Unlike in Arizona, the federal government has not sued the state to shut down prostitution, and unlike California's medical marijuana dispensaries, the fed has not raided any brothels in the state. You could argue that prostitution is also an international issue, since human trafficking is certainly a problem that crosses state and national borders, but the federal government has not taken any action in Nevada.
Probably the best litmus test for how the federal government will handle marijuana legalization in Colorado and Washington is to look at how it's handled legalized medical marijuana in other states.