Both pilot fish and remoras accompany large fish like sharks. The remoras actually do stick to the larger fish, by a sort of suction cup on top of their head. The pilot fish do not stick on, they just swim closely alongside. These fish do the shark no particular good, but no harm either. The small fish benefit however in a couple of ways. First, protection. The shark is their "bodyguard". A medium size fish that might eat the smaller fish isn't going to approach a shark. And secondly, when the shark feeds, the smaller fish eat the small scraps from the shark's meal.
Pilot fish get their name from the early belief that they actually guide the shark to food, the way a harbor pilot guides a ship in to port.