물어보다 is asking a question, and -고 links whatever came first — often in the spoken filler shapes 가지고, 이러고 or 라고. 보고 싶어가지고 물어본 거였어요 is 'I only asked because I wanted to watch it'; 이러고 물어보고 quotes the asker's exact manner, 'they asked, going like this'. 라고 물어보시더라고 is the plain quoting form, reporting the words asked.