A lot of race tracks have parks at them. Suzuka, Nurburgring, Singapore I believe. So, yeah, parks at the tracks, and also some wealthy people can get a top seat on the ferris wheels. And even just because they look good.
The ferris wheel at Suzuka was built specifically for the circuit. If there's one in Abu Dhabi, it's because there's a theme park right next door.
I do know that the one in Singapore - the Singapore Flyer - existed before the circuit was built. The section of track around the pits is a purpose-built section of track, and it was one of the few places the part of town that was hosting the race that pits complex could fit. There just happened to be a ferris wheel right there. The land wasn't picked because of the presence of the Singapore Flyer. It's a bit like the London Eye.
As said, they are purely for better seating & entertainment as a lot of big race venues now offer "amusement park"-like attractions for the fans to enjoy during the race. I believe the 'Ring is one of the very few to even have a roller coaster than runs parallel to the main straight.
Ive been to Daytona twice now for the 24 and i havnt been on the thing. This year im going to have to take a ride on it and get some photos from up top.