(a) Evidence for a straight chain
Experiment : prolonged heating with HI
$$C_6H_{12}O_6 \xrightarrow[\Delta,\ \text{long time}]{HI} CH_3-CH_2-CH_2-CH_2-CH_2-CH_3$$
Glucose is reduced completely to n-hexane.
Reasoning :
This drastic reduction removes every oxygen-containing group but leaves the carbon skeleton untouched.
The product obtained is the straight-chain hexane, not a branched isomer such as 2-methylpentane or 2,3-dimethylbutane. Since the skeleton is unchanged by the reaction, the six carbon atoms of glucose must already have been in an unbranched chain.
(b) Evidence for five $-OH$ groups on different carbons
Experiment : acetylation with acetic anhydride
$$C_6H_{12}O_6 + 5(CH_3CO)_2O \rightarrow \underset{\text{glucose pentaacetate}}{C_6H_7O(OCOCH_3)_5} + 5CH_3COOH$$
Two separate conclusions follow :
How many $-OH$ groups —
Exactly five acetyl groups are taken up, and acetylation converts one $-OH$ into one $-OCOCH_3$. Glucose must therefore contain five hydroxyl groups.
Why they must be on different carbons —
Two $-OH$ groups on the same carbon would constitute a gem-diol, which is unstable and immediately loses water to give a carbonyl group :
$$>C(OH)_2 \rightleftharpoons \ >C=O + H_2O$$
Since all five hydroxyl groups survive and are acetylated, each must sit on a separate carbon atom.
Putting the evidence together
Combined with the evidence for an aldehyde group (oxidation by bromine water to gluconic acid), these observations give the open-chain structure :
$$CHO-(CHOH)_4-CH_2OH$$
Six carbons in a straight chain, five $-OH$ groups on five different carbons, and one $-CHO$ group at the end.