Once the hay has been mown, the hayraker lifts it up and piles it into a row (called a window) ready for baling. We won't be baling ours though, we pile the hay onto poles in the old-fashioned way. I'll try and film some of it.
Here's a YouTube video showing something similar (ours is not a John Deere but the mechanism is fairly similar)
Here is another hayraking video - a bit noisier than the previous one and using slightly older machinery but the idea is the same.
Some rakers use a pinwheel system and sometimes these run at the side of the tractor rather than behind it.