How do I select row which has a max value in other column - PostgreSQL?
You were close, but you don't need the group by or the max(votes) window function when using distinct on ()
select distinct on (county) *
from primary_results_csv
order by county, votes desc;

The equivalent solution using window functions would be:
select county, candidate, votes
from (
   select *, max(votes) over (partition by county) as max_votes
   from primary_results_csv
) t
where votes = max_votes;

Online example