There are various ways to do this calculation. The "K equal sub-portfolios, buy and hold" method was used by Jegadeesh and Titman in their 1993 paper (they also mentioned another method, the "monthly rebalancing" method but did not show results from that method in the paper).
The method is relatively simple, but only an approximation of real investing. At the end of each month you form a sub-portfolio and hold it for K months. This generates K numbers, which are the buy and hold portfolio returns for each of the next K months.
Now consider how to determine the returns for the strategy for a specific calendar month, such as May 2017. During this month you hold K sub-portfolios: The newest is the sub-portfolio that was formed at the end of April 2017, then there is one a little older that was formed in March 2017, and so on, until you get to a sub-portfolio formed K months ago, which is about to be liquidated at the end of this month. Jegadeesh and Titman assume that you hold these sub-portfolios with equal weights, so they find they the return for the strategy for May 2017 by simply averaging the May 2017 returns for these K sub-portfolios.