From Lisbon, you can take coach services operated by Mafrense which depart from Campo Grande bus terminus. The journey lasts just over one hour and a single ticket costs EUR3.75 (no return tickets are available) 
The Tourist Office has further information on most tourist sights.
Mafra is known for its famous bread ("Pão de Mafra"). Give it a try at a local bakery.
Try also a special cake from the town known as "Fradinhos". There's a bakery called precisely "Fradinho" that sells this delicious treat.
Also try Polo Norte for more pastries.
There's not much nightlife in Mafra, but there's a nice place where you can have a nice cup of coffee. The name is "Café da Vila" and you can find it right next to the palace, near a garden with three soldiers. If you are lucky, you can be served by the most prettiest girl of this town :)