How do I colour a fluid simulation in Cycles based on velocity?
In Blender 2.82 and later, the fluid simulation engine used in previous versions has been replaced with Mantaflow. When Mantaflow simulates the fluid it provides a particle system that can be used to determine the velocity of the fluid in that region of the simulation.
To achieve this, use a Point Density node set to the Liquid Domain object with the Liquid particle system with a material similar to the following :

This takes the Object coordinates and converts into World coordinates - this is required as the particle system is always defined with respect to world coordinates. The Point Density defined the Object (the domain) and the particle system (Liquid) using World Space. Set the Radius to a suitable value such that the influence of each particle is large enough to prevent gaps and select Particle Velocity for the Color Space. The Color output will now represent the velocity of that section of fluid (with RGB representing X,Y,Z velocities.
In my example I used Separate, Absolute, Combine nodes to avoid negative values for use to colour the mesh for demonstration purposes. You can use a Vector Math 'Distance' node to convert the Color directly into a 'speed' instead, if desired.
Note that the Point Density can only be used with Cycles (ie, not Eevee).