Different number of posts per row in grid layout

This can be achieved by making use of Masonry a

Cascading grid layout library

Which is included in WordPress since 3.5 and has been updated to v3 with the release of version 3.9 of WP. It really is a nice tool to accomplish different kind of grid layouts. Of course it isn’t necessary to use this library, but it is indeed really good for grid layouts, so you might as well make use of it.

There are a ton of how-to’s and tutorials available, just take a look around and you will find them. Generally, the implementation is pretty straight forward and size management and control then works via CSS (and maybe some javascript/jQuery if you want to offer a switch for size changes).

As additional information, there is a – one could say – pro version of masonry available, which offers more functionality. It is called Isotope, if you want to take a look at it. Of course it isn’t part of the WP core functionality, besides you need a – very affordable – license to use it commercially.