I've been considering buying a Yongnuo external flash for a Nikon D3100, but I'm a bit confused. Which of them will work with my camera, the Yn565-ex or the Yn568ex Speedlite? I'd want the best one that is compatible with my camera, but I'd also not want to spend money on features that I won't be able to use.
Both will work fine if they are the model for Nikon cameras. Should say "for Nikon", and NOT for Canon, etc.
A difference in those two models are that the YN-568EX supports HSS, which the D3100 does not. Won't hurt, but it suggests that you may want to start with the YN-565EX, a bit less money. It will be a good flash. If you plan to upgrade to a D7200 or D750, etc, those higher models do support HSS. See http://www.scantips.com/lights/yongnuo565.html
I've been considering buying a Yongnuo external flash for a Nikon D3100, but I'm a bit confused. Which of them will work with my camera, the Yn565-ex or the Yn568ex Speedlite?
As long as you get the gold-lettered, four-pin Nikon version of either one, it will work and is safe and won't damage a Nikon dSLR. But. It's a Yongnuo. You may be playing a copy lottery, reliability is pretty much only good for hobbyist usage, and on-camera TTL/AF-assist performance may vary. My advice typically for a first-time flash purchaser getting their first/only flash for on-camera use is to save up a budget of at least US$200, and consider getting a used OEM flash that doesn't have to get shipped to China for warranty service or rely on a reseller's ability to supply a warranty. The low-low price has to come from somewhere. You can find a used SB-700 for around $200, and its complete backwards/future compatibility with Nikon bodies is pretty much assured. Yongnuo is great with current compatibility; maybe not so much with the future or backwards--the perils of reverse engineering.
To me, cheaper Chinese flashes typically make a lot more sense with 2nd, 3rd, and 4th flashes for off-camera shooting. Not so much as a first/only flash for on-camera usage. YMMV.
I'd want the best one that is compatible with my camera, but I'd also not want to spend money on features that I won't be able to use.
If you plan on doing off-camera shooting with the flash, then I'd say none of the Yongnuo line are terrific, because of the conflicting triggering systems that Yongnuo produces, and the fact that if you decide you want to add more features, you essentially have to repurchase all the triggering equipment (if not the flashes). At this moment, Godox's 2.4 GHz system is probably the sweet spot with the most room for expansion and the best system interoperability at a low price. Phottix has a better reputation, but also higher price tags.
$200 isn't a lot to spend on a flash, when you compare it with the price of a new lens. And a flash is something you can use with all your lenses, and will probably be more transformative to your shooting than a single lens will ever be. Budget accordingly.