How to determine the correct InChI for a certain compound?
One of the goals of the InChI project was to ensure uniqueness: [1]

Strict uniqueness of identifier
The same label always means the same substance, and the same substance always receives the same label (under the same labelling conditions). This is achieved through a well-defined procedure of obtaining canonical numbering of atoms.

Whilst this is often the case for InChI strings, there are some (complex) examples where the above goal has not been met, for example in the natural product Spongistatin (below) where two isomers incidentally have the same InChI key: [2]

InChI=1S/C63H95ClO21/c1-33(19-42(67)18-17-35(3)64)20-53-55(72)57-39(7)58(79-53)59(73)63(75)31-51(70)37(5)52(85-63)16-14-12-13-15-44-22-43(68)27-61(81-44)29-47(76-11)23-45(82-61)25-50(69)38(6)56(78-41(9)66)36(4)34(2)21-49-28-60(10,74)32-62(84-49)30-48(77-40(8)65)24-46(83-62)26-54(71)80-57/h13,15,17-18,36-39,42-49,51-53,55-59,67-68,70,72-75H,1-3,12,14,16,19-32H2,4-11H3/b15-13-,18-17+/t36-,37+,38+,39+,42+,43+,44+,45-,46+,47+,48-,49+,51-,52-,53-,55+,56+,57-,58+,59+,60+,61+,62+,63-/m0/s1
Although InChI can sometimes break (as per above) most of the issues with InChI strings are with implementation (how the structure is parsed to the thing generating the string in the first place). Several (common) features are at present un-supported by the InChI implementation:

Polymers
Complex organometallics
Markush structures
Mixtures
Conformers
Excited state and spin isomers
Local stereochemistry/chirality
Topological isomers
Cluster molecules
Polymorphs
Unspecific isotopic enrichment
Reactions

Generation of InChI strings
InChI is, by nature, an algorithm designed to be ran by a computer. Whilst strings can be parsed by humans (with ennough effort), the complexity of the strings is such that it is challenging to ensure they're correct. The InChI FAQ specifically deals with this:

You should not do so (though you of course can). This may give apparently reasonable answers but it is error-prone and may break relations in the InChI.

The most recent implementation of InChI is provided by the InChI trust, open source and free of charge.[3]
As alluded to above, a common source of InChI errors is the way in which the structure of interest is passed to the algorithm rather than with a fundamental flaw with the process used to generate it. Sh*t in, sh*t out, so to speak.
To give a concrete example, consider the heterocyclic system below:


Clearly, the two tautomeric forms cannot be distinguished chemically, but depending on how the InChI string is generated, they may end up having the same or different strings. In this case, we need to specify to the InChI algorithm whether we want to fix the hydrogens (to show a single tautomer, each of which would have a unique InChI string), or not fix them (such that both tautomers have the same InChI string)
Validation
The real question you're possibly interested in isn't How to determine the correct InChI for a certain compound?, but rather How to validate an InChI string for a certain compound?.
Given the complexity of the InChI strings, this is a challenging thing, and to my knowledge there is no tool which allows a string to be provided and says whether it is valid or not (similarly you can't provide a proposed IUPAC name to any tool which will say whether it is the IUPAC preferred name).
One thing you can do is use the InChI string to generate a structure (ChemDraw does this). Using your strings from the question, it's evident that they actually refer to different forms of the molecule (cyclic vs acyclic, just imagine the terminal primary alcohol attacking the ketone).

Chemically, it may be that the cyclic and acyclic forms are in equilibrium- in this case there is no way for InChI to represent the mixture (and hence which structure used to generate the string is ambiguous). It could also be that they are separable chemically and not interconverting, in which case quite rightly they should have different InChI strings.

[1]: Journal of Cheminformatics, 2015, 7, 23
[2]: http://www-jmg.ch.cam.ac.uk/data/inchi/ Accessed 3-Sept-2017
[3]: http://www.inchi-trust.org/about-the-inchi-standard/
Accessed 3-Sept-2017