If your mac turns on and is connected to wifi, go to the top left Apple logo, and select "ABOUT THIS MAC", the "size and year" will be displayed:
On older Operating Systems Click More Info to get the specifications:
if you are unable to turn on the mac, here are the PHYSICAL serial locations:
all iMacs
all macbooks:
only 2008 Macbook models (Under the battery)
the macbook serial locations are on the back panel, in or around the area shown, depending on the model, excluding all 2008 models.