YouTube will pay $24.5 million to resolve a lawsuit by US President Donald Trump over his 2021 account suspension, marking the final settlement with major tech firms.