When it comes to animated films (or most films in general), it doesn't need to be great to make a lot at the box office. With Illumination, you can say they run things like this. "Marketing first, everything else second." They hooked everyone with that trailer of nothing but sight gags, and heavily marketed things so everyone knew that it was coming, and when it was coming out.
Another factor is Illumination makes easy to digest popcorn flicks, quick, easy and if the kids really like it then they might have their parents take them to see it again. Add that to the marketing blitz, and you got something that'll make a nice bank even though it's only decent at best.
I know that also kinda' says something about the general public being easily amused, but how else do you explain something as cruddy as the past two Ice Age films making over $870 million dollars each?! (As well as being the highest grossing animated films of their respective years.)