Case-insensitive count duplicate line, remove duplicate by choose case with highest duplicate

And there's uniq --ignore-case --count | sort --numeric --reverse:

uniq -ic /tmp/foo.txt | sort -nr
      8 hot chocolate
      6 Xicolatada

And to switch around the order putting a comma in there add this pipe onto the end:

... | sed -e 's/^ *\([0-9]*\) \(.*\)/\2, \1/'

I would use tolower() to make all the items lowercase. Then it is a matter of storing them in an array a[] and then printing the results:

$ awk '{a[tolower($0)]++} END {for (i in a) print i, a[i]}' file
xicolatada 6
hot chocolate 8

To have the output in comma-separated format, add -v OFS=,.