My pedals are moving when I'm coasting, and if I try to stop them the upper segment of the chain gets really loose, and the rear derailleur does this thing, where it gets almost horizontal, and then something gives and the chain moves – then the whole process repeats.
Here's a video that shows what's happening – you may want to download the video, otherwise the quality is quite poor.
This makes the bike pretty much unridable – I'm new to bicycling, I'd appreciate any suggestions for how to figure this one out.
EDIT 8th Sept 2015
Thank you guys for helping me. I read the link given in second answer, and there were a lot words unknown to me, so I focused on common speeds, and according to that, I have a freewheel. I took it apart and cleaned it, according to this Youtube video. It didn't fix my problem.
But, I took a couple of photos of my cassete/freewheel (I'm not sure what it is), so maybe you guys can tell me what it is after all: Photos (download for full resolution).