It is not a clear science but fortunately an examiner can't just say "seems obvious to me"
In the U.S., first the examiner must find a base reference with an embodiment that has some of the elements of your claim, but not all. It must also be in the same field or could be "analogous art" from a different field where the same problem is being addressed.
Next the examiner must find all of the elements from you claim that are missing in the base reference. They might be from slightly different fields but to convincing should be in the same ball park. In some cases it could another embodiment found in the base reference but usually it is one or more other prior art references.
Now the hard part, the examiner must make an argument as to why someone of ordinary skill in the art would think to combine the teachings of the assembled references to produce the claimed invention. This is clearly susceptible to hindsight bias. Everything seems obvious once you know it.
There used to be a doctrine called TSM that required the examiner to cite either a teaching, a suggestion or a motivation in the prior art to combine the teachings.
A SCOTUS case, KSR has had much commentary. It said TSM was a good tool but not the only way to establish obviousness. Added was "obvious to try", "only a few things possible to try" and the issues of "likeliness to succeed" and "unexpected results" were introduced.
This has made it harder for an applicant to overcome an obviousness rejection. One argument that still works well is that, if to turn a reference into the claimed invention it has to be made unfit for its original purpose. Making a bucket unable to hold anything would be an example.