The spec has a section on Room State Resolution which depends on the version of the room. The currently latest version 10 has an algorithm described which I have not yet read. I have yet to understand if all homeservers should come to the same state conflict resultion on their own or whether the homeservers end up agreeing on a specific resolution.