Patches are being done by getting an original version of a source code file (let’s call it rev1), making changes to it (thus it becomes rev2), then using diff.
The patch applies cleanly to rev1, which is fine.
But, sometimes the same patch applies cleanly to other, modified versions of the same file (though, not always). When exactly this happens?
The exact conditions under which this happens depend on which patch application program you are using. However, most patch programs have heuristic algorithms which allow the base file to be different in certain ways from the base file originally used to create the patch.
Most useful patch formats contain a few lines of unchanged “context” lines around changed lines. The patch program will use the line number information in the patch file (which might be different) in conjunction with the context lines to find where the appropriate place to apply the change is in the new base file. Usually, the line numbers are permitted to vary somewhat but the context lines must match exactly.
In the case where the context lines differ and the patch program cannot find where the modification could go, it encounters a conflict (and might generate “rejected hunk” output).