From here : http://krdic.naver.com/help.nhn?page=3-1-2
‘ㅑ ㅒ ㅕ ㅖ ㅘ ㅙ ㅛ ㅝ ㅞ ㅠ ㅢ’ are to be pronounced as double vowels.
which means 의 is pronounced as ㅡ and ㅣ in succession. For example, 이 in 의사 would be pronounced as 으이 in succession.
Exception 3: When ㅢ is used on a consonant, it should pronounced as
늴리리 [닐리리], 닁큼 [닝큼], 무늬 [무니]
Exception 4: An 의 which is not the first syllable of the word can be pronounced as 이; an 의 used as a postposition can be pronounced as 에
의사 is a word with 2 syllables, and the first one is 의, hence it is pronounced as 으이
민주주의의 의의 -> [민주주이에 의이]
In 주의 의 is the second syllable, so is pronounced as 이
In 주의의, the last 의 is a postposition denoting a possessive, hence pronounced as 에
In 의의, the first 의 is the first syllable, hence pronounced as 의 [으이]
The second 의 is the second syllable, hence pronounced as 이
Some references from the web: