How do I connect my Mid-2010 iMac to my Late 2015 Macbook Pro
If you are using a 27 inch iMac (Mid 2010) then you need a mini DisplayPort to mini DisplayPort cable.

According to Apple's Support Page, Use your iMac as a display with Target Display Mode, you can accomplish this with the cable referenced above, but only with a 27" iMac if you are using the Mid 2010 model.