Sure, all of that is true. There are dozens of factors, hundreds of factions trying to put their fingers on the scales, lots and lots of moving parts.
Population density is hardly the only thing going on, it's an incomplete measure, however it's also a significant barometer. If I tell you a county has a high population density, you can guess it voted for HRC just from that and your odds of being right are pretty good.