You have to learn how to count bars and beats. Its basic stuff when it comes to making music, you have to know how to count bars and beats.
How many beats in a bar depends on the time signature, in modern music its usually 4 beats to a bar.
This might help...