A recent example of this is the DOJ's lawsuit against SpaceX for discriminating against asylum seekers, and the ITAR laws that prevent them from hiring asylum seekers (because they make missile technology and can therefore only hire US Citizens with security clearance). In this case, two federal laws conflict.
Another situation I am familiar with was a case where an employee on an H1B visa at a company I worked for had his visa expire after six years, and although the management made it clear that that meant he could not work there, he continued to hang out and do a few things. He then sued under the Illinois wage laws that meant the company was obliged to pay him for his time, even though it was illegal for them to hire him without a valid work visa. In this particular case the federal law was ignored and the state law took precedence.
Irrespective of those two cases (I'm sure a lot depends on the details), what are the general principles where laws conflict either from different jurisdictions or, as surely happens, within the same jurisdiction? I understand that "the court decides" but how does the court decide?
I'm in the USA, but also interested in what happens beyond my borders.