I
conjunction
BAD : Only when it started to rain he noticed that he had left his raincoat somewhere.
GOOD : Only when it started to rain did he notice that he had left his raincoat somewhere.
II
adverb
1
BAD : He not only was a talented pianist but also a great composer.
GOOD : He was not only a talented pianist but also a great composer.
◆◆◆
The position of not only should be the same as the position of but also (i.e. immediately before an object, immediately before a main verb, etc).
Compare: 'He injured not only his shoulder but also his elbow.' ('his shoulder' and 'his elbow' are both objects) 'He not only injured his back but also hurt his head.' ('injured' and 'hurt' are both verbs)
2
BAD : The level of pollution can only be reduced by the introduction of new laws.
GOOD : The level of pollution can be reduced only by the introduction of new laws.
◆◆◆
To avoid confusion in written English, only is usually placed as near as possible to the word or phrase that it modifies. Compare: 'Alison only posted the letter to Mr Jones.' (= she didn't write it) 'Alison posted only the letter to Mr Jones.' (= she didn't post the other letters)
In spoken English the position of only is less important because the speaker uses stress to make the meaning clear.
3
BAD : If you only would stay longer, your English would improve.
GOOD : If only you would stay longer, your English would improve.
GOOD : If you would only stay longer, your English would improve.
◆◆◆
When if only is used to express a wish, the two words usually stay together: 'If only I could stop smoking.' Sometimes, only is placed in front of the main verb 'If I could only stop smoking.'
4
BAD : Not only I passed, but I got a distinction.
GOOD : Not only did I pass, but I got a distinction.
5
See NOT ONLY