It depends on which muscle you are asking about. You have skeletal muscles which are under voluntary control and you have cardiac muscle that is under involuntary control.
When skeletal muscles contract you have a conscious thought to move (contract) them. For example, when sitting at your desk you decide to get up and walk outside. Skeletal muscle would enable you to do this. Several things must happen. Your brain (the thought) tells your body to get up. The muscles that allow you to do this must contract. A motor neuron sends chemical messengers to your skeletal muscles. These are called neurotransmitters. The neurotransmitter for skeletal muscle is acetylcholine. This chemical crosses synapses from one nerve to the next. This sets in motion a series of events that make you move. You need sufficient amounts of anions--charged particles like sodium,potassium,magnesium, and calcium to further propagate the muscular contraction (movement). These anions move into and out of the skeletal muscles which create an electrical potential that moves the muscles.
If the muscle is the heart, you do not have to have a conscious thought to make your heart beat. The myocardium is innervated by the vagus nerve (10th cranial nerve). Some of the same anions must be present in the correct amounts to make the heart beat, especially calcium and potassium.