[verb ます-stem] + に行く / に来る / に帰る [noun (する-noun)] + に行く / に来る / に帰る [noun (place)] + に / へ + [verb ます-stem] + に行く
に行く says you go somewhere to do something: "go and see", "go to buy". The purpose is a verb in the ます-stem – the polite form without ます – and it takes に. 行く is also written in kana, いく.
The ます-stem of 見ます is 見, of 買います is 買い, of します is し. The dictionary form does not go here.
The place takes に or へ, so a sentence can have two に: one for where, one for what for. Place first is the usual order.
The same purpose phrase goes with くる来る and かえる帰る.
These go beyond a verb before に行く.
A noun that takes する, such as かいもの買い物, べんきょう勉強 or りょこう旅行, can drop the します and take に straight away.
The ます-stem never changes. Past, negative and polite are all on 行く: みにいきました見に行きました, みにいかない見に行かない.