What does this formula mean?

agent.velocity.magnitude / agent.speed

I usually use it when I use “animator.SetFloat()”

Context is always crucial in something like this.
As a rule of thumb: if your question is less than 5 sentences, it is probably not describing the problem with enough detail.

Now assuming that agent is a navmesh agent then velocity is your current speed vector and speed is your maximum speed value (scalar).

So what that code does is give you a value between 0 and 1 of how fast your agent is going in relation to its maximum possible speed where 0 is stating still and 1 is max velocity in any direction.