What causes like electric charges to repel and opposite electric charges to attract at the smallest level? When talking about charged particles, the law of charge dictates that two particles with opposite charge will attract each other and two particles with the same charge will repel each other. 
However, I have never seen why this works. So, on a fundamental level why does the law of charge work? What causes like electric charges to repel and opposite  electric charges to attract at the smallest level?
 A: 
So, on a fundamental level why does the law of charge work? What causes like to repel like and opposites to attract at the smallest level

You are really asking why like  repels like and opposites  attract at the smallest level.
Physics does not answer ultimate "why" questions, because it is a discipline which  describes with mathematical models what is observed in nature. The models differ from maps because they not only fit existing data/measurements but are also predictive of new results of experiments and observations. Then the model can be used to answer why questions by  how from one state another state can be predicted or described. The ultimate why is contained into the laws and postulates of the theoretical model, which are a distillation of observations/measurements or necessary to identify the mathematical functions with physical measurements .
In electromagnetism it was observations of how matter could be charged and of how charges interacted that developed into the law of Coulomb. This means that the existence of opposite charges assigned to particles is a given of nature, a law.

Coulomb's law, or Coulomb's inverse-square law, is a law of physics that describes force interacting between static electrically charged particles.
.....
The force of interaction between the charges is attractive if the charges have opposite signs (i.e., F is negative) and repulsive if like-signed (i.e., F is positive).

This was the classical macroscopic observation that  is implicit in the laws and postulates of electromagnetism, i.e. the physics axioms that pick out from the infinity of mathematical solutions of the differential equations of the mathematical model those that describe nature and can predict new observations.
Once the microcosm started being explored classical mechanics  and classical electrodynamics became inadequate to describe and predict behaviors. Quantum mechanics and special relativity were necessary to describe mathematically and predict results.
The laws of the classical regime are also laws of the quantum mechanical regime or can be seen to emerge from them. This is necessary because there should be a smooth continuity in the predictions of the solutions of the models in phase spaces where both views could be used to calculate and predict charged particle behaviors.
So the answer to your question of of "What causes like to repel like and opposites to attract at the smallest level" , i.e  is because that is what measurements and observations say. The "how" is given by the corresponding mathematical theory of quantum electrodynamics

QED mathematically describes all phenomena involving electrically charged particles interacting by means of exchange of photons and represents the quantum counterpart of classical electromagnetism giving a complete account of matter and light interaction.

Thus the "how" can be described mathematically, given the axiom that charges exist and like repels like and opposites attract.
A: Electric charge is fundamental to the structure of matter.
The atomic nucleus contains protons, which attract electrons that occupy different levels of energy, or electron shells around the nucleus.  Atoms can become electrically charged ions by gaining or losing electrons from their outer shells, unbalancing electrical charge within the atom.
Benjamin Franklin coined the terms "positive" and "negative" to describe his single-fluid theory of electricity.  He described electricity as a fluid that flows from objects with excess electrical fluid (positive) to objects with a deficit of electrical fluid (negative).
By convention, objects likely to lose electrons are called negative, and objects likely to gain electrons are called positive.  But also by convention, the flow of electricity is considered to move from positive to negative (thanks to Franklin).  Thus, electric current is by convention said to flow opposite to  the actual flow of electrons in a conductor.
The source of electrical charge is the attraction between protons and electrons in the atom, and the repulsion of each for its own kind.  So far as I know, there is no classical explanation for why such attraction and repulsion exists in protons and electrons.  It's a fundamental force in the Universe.
A: 
Why does the law of charge work at a fundamental level?

Physics doesn't have at the moment a theory on a subatomic level (below the level of virtual photons) describing how the interaction between charged particles works. Furthermore there aren’t any observations which detected any inner structure of these interactions.
The nearest working theory describes this interaction by the help of virtual photons. For physicist in universitary education this seems sometimes to be strange. For illustration here are some examples from this side:


*

*But if it’s all virtual photons, how do we get the difference between a magnetic and electric field? Virtual photon description of B and E fields 

*Isn't both the electric field and magnetic field consist of virtual photons? How virtual photons give rise to electric and/or magnetic field?

*... in electron-positron annihilation with photon production (talking about low energies only) there's electromagnetic interaction (is it?) which means a photon being a virtual particle. Electron-positron annihilation with photon production. Virtual particle

*How do we know that charges interact by photons? Has it been observed or is it an assumption in quantum electrodynamics? The way in which charges interact
Physical theories could follow observational facts or they could be developed from phenomena not described in a theory or not described satisfactory enough. The last is called deductive reasoning.
Since in physics it is allowed to build theories let us try in short to build one for charged particles. Following the Standard model we want to try to use particles again.
How many particles are needed
Only gravitational phenomena don't need more than one particle. A hypothetical graviton is enough to describe gravitation. For electromagnetic interactions are needed minimum two different types of particles. Let's call them p- and e-quanta.
Furthermore we could follow the model of electric and magnetic field lines. Such lines are of a steady behavior. To build field lines from only two types of constituents it is helpful to define - as long as no one finds an inconsistency in the developed hypothesis -a hypothetical conglomeration of these two particles, which we could call clusters. The clusters have to have an inner structure. But the inner structure is unknown to us and we don't care about this. The only two things we have to define is that


*

*the observed steadiness in field lines we reach by the thesis, that between the clusters in the chain of a field line the number of the quanta increases from cluster to cluster by exact two quanta, one e-quanta and one p-quanta

*clusters are polarized and could form or an electric dipole moment or a magnetic dipole moment.


Adding the hypothesis


*

*that such feld lines could unite only on the ends of the cluster chain and only with opposite sign and

*the chain of magnetic clusters are possible only in closed chains


we reached the completeness of our model.
Use of the quanta-cluster-hypothesis
It is well known that the charged particles electron and proton have both an electric field and a magnetic dipole moment. Furthermore it is fact that photons have an electric field component and a magnetic dipole moment too. Additional it's established that photons are emitted and absorbed by electrons and photons.
Following the above described model it's possible to understand more in detail


*

*the energy exchange between particles

*the bend of electric and magnetic field lines (there one field lien is cant be another)


*

*the interaction only of electrically opposite charged particles with energy release in the form of photons


*the non-influence of magnetic forces on the electric property of charges and of electric forces on the magnetic dipole moment of charges (but about the Lorentz force see here)


Advantages and predictions of a quanta-cluster model


*

*The model shows why particles and their antiparticles annihilate and why electron and proton don't (because of the clamed steadiness of the field lines)

*From the model could be shown the structure of photons

*A prediction of this model is that magnetic and electric fields displace each other due to the fundamental understanding that where a body is a second can't be and the application of this to clusters.


No one can prevent nor prohibit thinking about these or other models. In science, models are right up to the detection of inconsistencies. The non-observation of the quanta of the model follows the tradition of postulating the atoms (ἄτομος indivisible) by the ancient Greeks, postulating the antiparticles, or postulating the Higgs-particle.
A: Short answer:
It is a consequence of


*

*Physics is governed by a stationary action principle

*Locality

*Lagrangian is Lorenz Invariance

*Gauge invariance
Long answer(and still skipping lots of math):
From a relativistic point of view:
Starting from the action principal, we try to write down a simple action involving the action potential $\vec{A}$ and electric charge $q$
$$Action = \int -mc^2 d\tau -\frac{q}{c} A_\mu dx^\mu$$
Multiplying by $\frac{dt}{dt}$
$$\int\left(-mc^2\sqrt{1-\left(\frac{\dot{x}}{c}\right)^2} -\frac{q}{c} \left(cA_0 + A_m\dot{x}^m\right)\right)dt$$
Therefore $$\mathscr{L}=-mc^2\sqrt{1-\left(\frac{\dot{x}}{c}\right)^2} -\frac{q}{c} \left(cA_0 + A_m\dot{x}^m\right)$$
After applying the Euler-Lagrange equations, we get 
$$ma^m=q\left(\left(\partial_0A_m-\partial_mA_0\right)\vec{u}^0+\left(\partial_nA_m-\partial_mA_n\right)\vec{u}^n\right)$$
$$F=q\left(\vec{E}+\vec{v}\times\vec{B}\right)$$
We could also define a tensor,$F_{\mu\nu}$ to simplify the equation
$$F^\mu=eF^\mu_\nu u^\nu$$
Let $j^\mu=(cp,j^m)$ where $j^m$ is the conventional current density.
Now consider $$\mathscr{L}=F_{\mu\nu}F^{\mu\nu}+j^\mu A_\mu$$
It may not look gauge invariant at first, but after adding gauges, one sees it is indeed gauge invariant.
After applying Euler-Lagrange equations for fields, one can derive
$$\nabla\cdot\vec{E}=\frac{j^0}{c\epsilon_0}$$
From that column law can be derived.
$$\vec{E}=\frac{kq}{r^2}\hat{r}$$
Letting $\vec{B}=\vec{0}$, $\vec{E}=\frac{\vec{F}}{q}$
$$\frac{\vec{F}}{q}=\frac{kq}{r^2}\hat{r}$$
$$\vec{F}=\frac{kq^2}{r^2}\hat{r}$$
Therefore if the charges are the same, they will repel, if not, they will attract.
