Quote from the FAQ post "How does “Reputation” work?" (current revision).
Deleting and undeleting posts may reverse reputation effects as well, if these posts have votes. Actions previously taken on deleted posts cease to affect reputation within five minutes (source), unless the post meets both the following criteria (in which case the reputation effects will be permanent) (source):
- The post had a score of at least +3
- The post has been visible on the site for at least 60 days
So there is an exception - posts with score three or higher and visible for 60 days. Other than that, the reputation changes coming from the votes on the given post are reversed on deletion.
As far as I can tell, the type of deletion does not matter, it works the same for self-deleted posts, posts deleted by delete votes of other users, posts deleted by roomba. (At least I did not notice in the FAQ that some of those should be different from others.)
For a self-deleted answer, this is quite easy to test - you can simply delete it, wait a bit to see how your reputation changes. Then undelete it - and after a while the reputation should return back to the original value. (You can delete your own answer unless it is accepted. It is more difficult for questions, since the situation when the software will not allow you to delete your own question seems to be more frequent - it depends mainly on the number of answers and whether they are upvoted.)
There are also a few related posts on this site: