Where are Mail.app rules stored? They got deleted and I want to restore them
The rules are stored in a property list at:

~/Library/Mail/V2/MailData/SyncedRules.plist 



Restore this file from a backup.
Restart Mail.app.
Re-enable the rules. 


These days check for a V3 folder (El Capitan). Restoring only the SyncedRules.plist may not work as another .plist file indexes the active state of the current rules set. What worked here was to go back to an earlier version of the ~Library/Mail/V3/MailData directory (note that it is in the V3 directory-- not the V2 directory). This takes a few minutes as Mail has to re-import your messages, but it did restore rules which were not restored by restoring the just the ~/Library/Mail/V3/MailData/SyncedRules.plist file only.