This is a convenience for a common usage of Avalanche, which is to broadcast a transaction and then wait for it to finalize before considering the transaction "done".
This creates a nice dev UX, where, if this call returns successfully, the transaction(s) can already be considered fully accepted, and no further status change will happen (barring something catastropic happens).
By default (0), this timeout is disabled and ignored, and the endpoint returns immediately after broadcast.
If a non-zero timeout is set, the request waits until the tx is finalized (or all txs are finalized in case there's multiple).
In case of a timeout, we return a 504 error, which normally indicates a timeout from the server side, aka. "Gateway timeout".
To limit abuse, a 120s maximum timeout is picked, which seems like a good maximal wait amount for a "pay" request (browsers usually time out HTTP requests after 5 minutes). Users that want to wait beyond this can also use the WebSocket interface.