First it is very important to know that molecules don't freeze at one geometry and stay there forever. Even at absolute zero temperature, a molecule can go through any geometry imaginable, and what you call molecular structure is one of the most likely structures, which would be more accurately termed equilibrium structure. Even more sophisticated definitions are also present, depending on wether you measure the vibrational average or thermal average or the actually most statically likely geometry, but I believe this is beyond the scope of this question.
With finite temperature this is more of a problem, in many cases the notion of a single structure may be completely inappropriate.
There are a lot of ways to determine molecular structure. However, they all have limitations. You may be surprised to learn that for many molecules, the structures are not yet determined.
Various experiments can provide information regarding equilibrium structure. For small molecules, microwave spectroscopy can be used to get geometry information. Other spectroscopy methods that can achieve high enough precision to resolve rotational states can also be used to obtain a direct measurement of molecular structure. These are especially useful if the molecule in question is difficult to prepare or unstable, such as reaction intermediates, ions and free radicals. Examples include Slow Photoelectron Velocity-Map Imaging, cryogenic IR spectroscopy and cryogenic ion spectroscopy. Note that these method only work for isolated molecules in gas phase, and all these are limited to very small molecules.
For larger molecules, if you can obtain a crystal of it, you can use X-ray crystallography to determine the coordinates of atoms inside. However, it is important to realize that crystal structure of a molecule can be qualitatively different from the structure in gas phase or solution; also, it is not always possible to obtain a crystal.
If you absorb an molecule on a surface, you can use atomic force microscopy to directly measure the molecule. However, similar to crystallization process, absorption and AFM itself may disturb the structure, and you cannot just put anything you want on a surface. AFM is also limited to the atoms on the surface and cannot see atoms wrapped inside, so it is also limited to rather small molecules.
In solution, the situation is usually much more complicated and there is not even a clear definition of equilibrium geometry anymore. For example, even a relatively small number of water molecules can form thousands of different water clusters, each having different equilibrium structure; in bulk water that number is astronomical. There will be no measurement of a quantity if you cannot even clearly define it.
On the other hand, you can use quantum chemistry methods to calculate the geometry of a molecule. This can be done fairly accurately for a moderately large molecule, provided that the electronic structure of that molecule is not too complicated.
Currently one of the most reliable method of predicting molecule structure is coupled cluster method. For small molecules (let us say up to 100 atoms) CCSDT/CBS is usually describe as "gold standard" and in many cases can provide similar precision with experimental measurements.
For large molecules (for example, up to a few hundred atoms) one usually use density functional theory, which less reliable but in many cases can still be surprisingly accurate. However, if not used correctly it can easily provide results that are not even remotely correct.
For even larger molecules such as protein, molecular mechanics methods or a mixture of quantum and classical mechanics can be used, which by the way won the 2013 Nobel Prize in Chemistry. This is, however, so dependent on the details of implementation and expertise of the users that any results must be viewed with utmost discretion.