Fix one point as the anchor. Calculate slopes from the anchor to every other point. Points with the same slope relative to the anchor must be collinear with it.
Why slopes? Two points define a line. If point B and point C both have the same slope from anchor A, then A, B, and C are on the same line.
Represent slopes as reduced fractions (dy/gcd, dx/gcd) instead of floating point division. This avoids precision errors. Handle vertical lines with a special marker since dx = 0.
For each anchor, use a hash map to count how many points share each slope. The maximum count plus (for the anchor itself) gives the answer for that anchor.