Length of Idea
The correct way to notate a music idea depends on the motive/idea itself.
Music notation software is usually designed around music engraving standards. So usually it will determine the correct way to notate a music idea. So, you should just be able to enter the notes and how it sits is what an engraver would do. However, algorithms can make mistakes because they are not interpreting the music as a human player would. Just following music engraving best practices as determined by the manufacturer and the programmers.
Typically you want the idea to lay out on the systems in a way that makes it easy to play. So it reads as simply as possible. The main point is to avoid confusion. Sometimes you can get away with compressing things if the idea is in a book/paper by itself. There is a bit of a balance between the amount of information and how much space it really needs.
Playability vs Readability
One of the biggest questions in the correct way to notate a music idea is playability vs readability.
You should do your groupings by the overall theme with the emphasis on what is easiest for the player. If there is a lot of complicated information in the measure, it may be somewhat long. But you want to avoid creating inconsistencies with the rest of the piece. For instance, if one measure stretched out to the whole system but the next system was four measures. This would make the overall counting/reading of the piece be difficult to follow. But it might make sense if the piece was slow or there were a lot of grace notes. If it’s grouped together with other material that follows a similar format it may be acceptable.
Layout Tricks
Another way to figure out the correct way to notate a music idea depends on the layout itself.
Sometimes you can shrink the size of the layout by a few degrees in order to get everything to fit. Sometimes just the system is all that’s needed. Maybe it’s just the words. Sometimes enlarging everything can fill-up the width of the page better. Other times it’s a combination of shrinking some parts (like words or dynamics) but not the notes. There is not a hard and fast rule —if anything, it’s “start with just a few things first and slowly change things until it fits”. This way, you are doing the bare minimum to the standard layout to make it work.