The major role that is played by both of these is diffusion.
In this book, Diamond argues that diffusion is very important. He says that most technologies (including farming) are spread by diffusion, not by societies coming up with those technologies on their own. Both war and trade are means of diffusion. Trade can spread a technology from one place to another as people in one place buy new things from another place. War can cause diffusion as people from one place conquer another and one side adopts technologies that the other had.