The very basic explanation is that, as Amarine wrote, -kun has a boyish connotation while -chan has a feminine or cute connotation.
Social rank factors in in the sense that you would use -kun and -chan mostly for people of a status lower than your own, and for peers with whom you are not close enough to refer to them just by name, nor distant enough to suffix -san.
The rules are not set in stone, and in media tomboyish girls are stereotypically depicted as being suffixed with -kun and vice versa for guys. Chan especially can also be used to show affection by suffixing it to people, animals or things that you like or are very close to. In any case, you should be mindful of nuances when applying them to people (my girlfriend will sometimes address me as -chan and I don't like it -_-).
A ton can be said about this subject, and I'm sure the people here would be glad to give a more detailed explanation if necessary.
June 25, 2014 at 6:23am