How beams work
Beaming is a cooperative effort between notes and rests. Yes, beams can be applied to rests. The word "Note" below applies equally to notes and rests.
No Beam - The note will not connect to any other note
Start beam - The note is willing to attach itself only to the next note. It will not connect to the note before it.
Middle beam - The note is willing to attach itself to either the note before or after. This applies to Beam 16th sub and Beam 32 sub as well.
If the two consecutive notes are willing to connect to each other they will beam, if one of them is not willing, the two notes will not beam.
Auto - The beaming pattern defined in the time signature will be applied to the note.
By default, all rests are set to no beam, so they will not beam to notes. If you change the beaming on a rest to auto the rest will follow the definition in the time signature as though it were a note.
See also How to add a beam over a rest