A molecule of hydrogen is formed by two hydrogen atoms, that is a fact.
How does it work? When two atoms, known as "diatomic" pair with another in a bond known non-polar covalent bonds. Where they equally share electrons. A Hydrogen atoms needs 1 more electrons to fill its first shell fully and have a full valence shell. So if two H's share their electrons, they'll both have a full V-Shell!
That's the basics of both the H-H bond and all the other diatomic bonds as well.