There are guidelines of course. Ports can have any number of CATEGORIES
(typically just one or a few), some categories are "virtual", but most are "physical" which means they correspond to a directory in the tree. Every port must have one primary category, this will be the directory where it is put. It should be the "best match" (as specific as possible while correctly describing what kind of job this software does).
But then, ask a few people and you will get different opinions what should be the best matching category for a specific port. ?
So, indeed, the original author of a port will put it somewhere. If this choice isn't blantantly wrong, the port will stay there.