There is DDR, DDR2, DDR3, and now DDR4.
Most motherboards we use require DDR3 at this point. Nearly all of them.
DDR4 is just coming online, and starting with the next CPU release from Intel, DDR4 will be used. DDR and DDR2 are older, and only seen on very old motherboards now.
You cannot mix one kind of DDR with another. If your motherboard supports DDR3, them DDR3 is the only memory that can be used.
There are now a few types of DDR3. If you have a newer motherboard with UEFI BIOS, then all of these DDR3 memories will work fine. But if you have a pre-UEFI BIOS motherboard, some of the new high density DDR3 sticks will not work with them, and some of the newest PnP DDR3 memory sticks will also not work with them.
The solution is to look at the web page of the company that makes the motherboard you want to buy memory for. On the page they have for that motherboard will be a support link. Clicking on that link brings you to a page where you will see links to the supported CPU list, and the QVL (Qualified Vendor List), or fancy way of saying Tested and Approved Memory listing. Open the QVL list, and find a match from the product number at a dealer, and then buy that exact kit. If you want to be 100% certain that the memory will work with your motherboard, the model number of the kit must match that listed exactly. Also pay attention on that list to the speed of the memory kit... 1866 is pretty much the fastest memory you want. Also pay attention to the capacity of the kit. Always buy a kit of 2 sticks of memory. If you want 8GB total, buy a kit of 2 x 4GB memory. If you want 16GB, buy a kit of 2 x 8GB memory. It is harder for 4 sticks of memory to work at tight memory settings than with 2 sticks. And never just buy a single stick. All of these computers have dual channel memory controllers. You want to keep both channels loaded with a stick of memory.
And finally, make sure you buy a kit of 2 sticks and not just 2 single sticks. The kits have had the 2 sticks of memory tested together to make sure the memory controller will be able to easily work with both sticks.
It sounds complicated, but its actually pretty simple in the end. You want 1600 or 1866 memory. There is not a dramatic difference between the two speeds. In addition to the memory speed, you want a low latency, or CL. For 1600 you probably want CL7 or CL8. On 1866 speed memory, look for CL8 or CL9. A lower CL number is faster. Sometimes the companies don't show latency as a CL number, instead they will show it as a 3 or 4 part number. So 9-11-11-28 would be a CL of 9. 7-9-8-24 would be CL7.
If you would like a more detailed explanation, Toms posted an article that explains things in more detail than I can go into here. I think reading it would help you understand what I have said better...
http://www.tomshardware.com/reviews/ddr-dram-faq,4154.html
Hope this helps you.