To my knowledge, we have not actually experienced any (or, at least, many) cases of stars suddenly shining where there was no star before in recorded history. This would be a misconception.
That is not how we learn about star formation. It happens over much longer time scales than we humans have been around.
As ideasrule points out, when we look out into the universe, we see millions upon millions of stars in various stages of development, from collapsing disks of dust and gas, all the way to exploding novae, all the way to burnt-out cool cinders.
In a sense, we have millions upon millions of "frames" in the "film" that is a typical star's life. All we have to do is put them in the right order.
That's how we know how stars form.
Well, that and all the math stuff...