Some MP4s have keyframes on scene changes. Others seem to have random keyframes, or keyframes every X seconds. What causes this discrepancy? Some MP4s have keyframes on scene changes; others have keyframes seemingly randomly placed, or placed every 5-10 seconds. I prefer the former, both for ease of editing and because, unless I'm misunderstanding the mp4 codec, it's the most efficient.

How would I force one behavior or the other in ffmpeg or Avidemux? (Specifically I would like to force the former, although I would like to know what causes the latter just out of curiosity.)
Putting keyframes on scene changes is more efficient encoding wise on average, but it can cause trouble for decoders with very small buffers. Constant keyframe intervals (GOP Length) and CBR were more necessary when people were viewing videos on iPods with very little memory, as opposed to phones with a gigabyte or more of RAM. 

This is an answer explaining how to configure it in FFMPEG: https://stackoverflow.com/a/41735741/8599496