What are the rules on how a pitcher gets credited with a Win, a Loss or No Decision?
Complicated question. A starting pitcher must go at least 5 innings to get a win, however he can get a loss in the first inning. A relief pitcher can come in at anytime and if his team takes and holds the lead while he is pitching then he gets the win. If a reliever comes in for a starting pitcher and allows the other team to score or take a lead then the starter gets a no decision. This would also apply to a relief pitcher who is pulled for another relief pitcher.
Any pitcher who has a lead and has men on base when a relief pitcher comes in can either win or lose if the men he allowed on base score. The exception to this is if they arrived by error, that would be considered an unearned run.
To explain the last paragraph it is very complicated but I will attempt. Let's say a fly ball is hit to center field but the center fielder drops the ball. Runner is on second, that is a two base error and that would have been the third out. The next batter gets a hit and ties the game. The pitcher is pulled for a reliever but he is not responsible for the run that scored. However he is responsible for the guy at first base. The next batter gets a double and the guy scores from first. He would then get a loss if the score remains the same. However should his team tie he would get no decision.
Now lets say a starter has gone 5 innings and given up one run in the top of the 6th. He is losing 1 to 0. He is due to bat the next inning but they pinch hit for him. His team scores at least two runs and holds the lead. He would be the winning pitcher.
Same situation applies to a reliever, only he would not be required to go 5 innings.
There are probably other things I missed, I'm sure someone else will follow up.
Saves are another situation which you didn't bring up. That one I'm not quite as clear about but I believe you need to pitch the final inning with a lead no larger then 3 runs to obtain that.