Don't think that rhythm is something that belongs to music only, or perhaps poetry. It's also one of the Elements of Composition, helping to lead the viewer's eye across a painting. The example I've shown here is of a extreme landscape format, considerably wider than it is tall. To get the viewer's eye from one edge to the other there needs to be something that will keep them looking, moving from one bit to another to another. An underlying rhythm to the composition can help achieve this.
The top photo is of a thumbnail sketch, one of several I did when planning this painting. (I know it looks big in this photo, but if I'd put the photo of it in proportion to the painting itself you wouldn't have been able to see what was going on.) I started by drawing a free-hand rectangle to represent the shape of the canvas, then tried arrangements of the sheep heads and bodies of the sheep. (Very stylized sheep, without a doubt, but no-one else needs to be able to read a thumbnail, only the creator.)
The options I gave myself were a sheep from the front, side, and back, giving three body shapes. The other consideration was the alignment of the heads, and thus the bodies. If you read the thumbnail from left to right, the heads could almost be like musical notes, with the tune going both up and down and some notes being played faster and slower (closer together and further apart).
When I had chosen a composition from my thumbnails, I then loosely blocked this in on the canvas where I'd also blocked in green (for grass) and blue (for sky). If you compare the middle photo with the thumbnail, you'll see I've amended the composition, adjusting it as I blocked it in as I discovered my thumbnail hadn't been long enough. (My excuse: I don't often paint on such a long canvas.)
It's easy to loose the underlying rhythm when you start to paint, to stop seeing it. If you've made adjustments and something doesn't seem to be working quite right, step back and reassess the strong shapes and lines in the composition.
If you look at the bottom photo, you can see there are three horizontal lines that lead the eye across: a gently curved one where sky meets land (shown in light blue) and a squiggly one above and below the sheep (shown in white). The arrangement of the faces of the sheep (shown in yellow, with one head being seen from the back) creates a rhythm to bounce or dance the eye along. The four on the left look to me like the opening beats of Beethoven's Fifth Symphony: baa-baa-baa-BAA. Followed by a ripple and two chords.
Rhythm helps to convey the emotion that you want to give the audience in a painting. The sheep above are spaced fairly randomly, a groups of four, then one on its own, three very close together, and then a pair. Though given one sheep has its back to us, you might see that grouping as two; alternatively you might put the four sheep together in your mind. Such ambiguity adds to a composition.
As the eye runs across the painting (remember that in the West this tends to be from left to right because of our writing system) it is continually surprised by the variation in number. This gives a sense of expectation and discovery. If there had been successive groups of the same number of sheep, the viewer would be able to predict the next group, and be lulled into a sense of calmness. A totally different encounter for the viewer. Remember the Rule of Odds, and to vary the rhythm in your composition.