They fired because of the ships. Had Lincoln not sent those ships, they were going to wait Anderson out. Anderson had already started drafting an evacuation order.
If you read the details surrounding Beauregard's battery assignments, he held numerous batteries in reserve just for the ships. In fact, I believe I read that he held the bulk of his batteries in reserve to deal with the ships. He only attacked Sumter with part of his forces.
Once again, I will remind people that the Confederates knew why the ships had been sent, and it was only after the ships had been sighted rendezvousing at the designated point that Beauregard decided he didn't have any more time to give Anderson.
A man would have to be a fool to allow someone to attack him from two sides at the same time.
Reason why they fired is immaterial. The fact that they opened fire on a United States installation is enough to complete the act. The South started war.