You don't have to make it harder than it really is. If you have a "3" over 3 eight notes, that means the three of them fit into one beat. That's easy, and you probably know that already. The other numbers in brackets on your second example work similarly. If you have 5 sixteenth notes with a 5 written over them, then you fit them all into one beat. That's simple enough, I think.
It may become more complicated, so if you have 18 sixteenth notes with a bracketed 18 over them, then you obviously do not fit them all into one beat. You have to use a little common sense; normally 4 beats would be filled by 16 sixteenth notes, so if there are 18 bracketed 16ths, you would squeeze them evenly into four beats. Or if you have 7 bracketed 16ths with a 7 on top you'd stretch a little bit so that they fit evenly into 2 beats. Get the general idea?
With you do it strictly in time or not depends on the piece and the composer. Chopin has a lot of such notation and often means for you to be pretty relaxed, keeping the basic pulse, but not putting in all the little notes exactly evenly spaced. Other composers might put a bracketed 5 16ths in one hand and 4 normal 16ths in the other, intending you to play the polyrhythm exactly in time.
Bill