What happens when two or more plugins use the same hook?

There is priority as explained in the codex:

add_filter ( 'hook_name', 'your_filter', [priority], [accepted_args] );

Lower numbers are executed first, the default is 10.

If you have multiple functions at the same priority, they are run in the order in which they were added to the filter.