What is the Value of X in KNN and Why?
Green circles and blue squares are samples of two different classes. How does it matter that "X" belongs to which one of either of these "Green circle" or "Blue Square" class?

Likelihood should be done based upon the number of classes and the K value, instead of dataset samples.


  For me likelihood weight will be:
  
  Likelihood of being blue square ~ 0.66 i.e. 2/3, whereas likelihood of
  being green circle is 1/3.


Prepared another example:
Where I have 2 Green circle and 16 blue square, whereas K=5


If I follow your approach, likelihood of
Green Square is 1/2, Blue square is 4/16 = 1/4, whereas from the image it's clear that "X" belongs to Blue Square class only.

[Update]
Thanks @Ben Reiniger, for correcting me.

I spent more time and what I understood is, it's not always correct to put equal weights(likelihood) across different classes in dataset. My earlier observation was based upon the assumption that all classes have equal weights and I was wrong, even though data is bit skewed.

Consider an another example:

We have a huge dataset of patient reports, where features are created based upon the several tests done so far. Our task is to identify the possibility if a particular person suffering from cancer or not.

In this case, even if a single feature point towards cancer disease, we cann't neglect it and should predict towards rare class, such that patient can go for further analysis.

In such cases weights are not equivalent across different classes.
According to me, wights should be defined based upon the use case.

A very well explained its calculation in How does Weighted KNN works?