With most cars, there is a button that you push and hold for several seconds. When you do that, the light will go off, even if you had not done any maintenance to it.
As for what set off the light to remind you about maintenance schedule, differen cars might have different ways of calculation.
To answer your final question, no, it is not necessary to go to the dealer.