Is there no electromagnetic force between the positively charged nucleus of an atom and the electrons?
Or in other words which forces keep electrons in orbitals and prevent it from flying away or crashing into the nucleus according to modern understanding?
There are a lot of good answers here already, but I'll try to attack the question from a new angle.
Firstly, yes: they experience an attractive force from the nucleus, and would in principle have their lowest possible potential energy if they were located exactly in the nucleus. An equilibrium state is the state with lowest energy, so why aren't they exactly in the nucleus?
Consider that an electrons position and speed cannot be exactly defined at the same time (uncertainty principle). So an electron with an exact position could have any speed. If you compute the expectation value of a particles kinetic energy, when the particle can have any speed, you'll find that it's divergent (goes to infinity).
So: Because an electron with an exactly defined position must have infinite kinetic energy, the equilibrium state cannot be an electron with an exactly defined position, and so cannot be an electron exactly in the nucleus. So what do we do?
We have to make the electrons position "diffuse". Of course, that means it is no longer exactly inside the nucleus, so it gains some potential energy, but on the other hand it can move more slowly and has lower kinetic energy.
The equilibrium state is the state we find where the trade off between kinetic and potential energy gives us the lowest total energy, which is described as a 1s orbital. The electron is "diffuse" enough to have a relatively low kinetic energy, and "localised" enough to have a relatively low potential energy, giving as low total energy as possible.
Once you start adding more electrons you need to start taking Pauli exclusion into account, so I won't go there, but the same manner of thinking still essentially holds up.
Yes, there are an infinite number of velocities you can use, but if you look at their distribution, you'll find that it quickly goes to zero somewhere around 1-2 m/s, so the expectation value of the velocity is convergent.
If you have an object with a velocity taken from a distribution that doesn't approach zero sufficiently fast as the velocity goes to infinity, the expectation value diverges. A simple example would be a person that would be half as likely to get up at a velocity of 2 m/s as 1 m/s, and half as likely to get up at 4 m/s as 2 m/s, etc.
The more mathematical version of the same argument is to compute the kinetic energy of a particle whose wavefunction is a delta pulse (i.e. a particle whose position is exactly defined), and you'll find that the particle has infinite energy.
The follow up question would be the opposing force which keeps them in orbit(als)? This balance of force was called the planetary model which has this shortcoming that electrons might fall into the nucleus.
If electrons actually followed such a trajectory, all atoms would act is miniature broadcasting stations. Moreover, the radiated energy would come from the kinetic energy of the orbiting electron; as this energy gets radiated away, there is less centrifugal force to oppose the attractive force due to the nucleus. The electron would quickly fall into the nucleus, following a trajectory that became known as the "death spiral of the electron". According to classical physics, no atom based on this model could exist for more than a brief fraction of a second.
What this means is that within the tiny confines of the atom, the electron cannot really be regarded as a "particle" having a definite energy and location, so it is somewhat misleading to talk about the electron "falling into" the nucleus.
As I understand it, it's the quantum part of quantum mechanics.
Electrons can only have fixed energy states, they can only radiate or accept fixed sized packets of energy - a "quantum" of energy. So an electron that is hit with the correct sized quantum of energy can be excited up to the next orbital, and it will emit the same sized packet of energy when it returns to its ground state. So they can't gradually emit radiation and fall into the nucleus.
Eventually electrons should spontaneously decay but that's predicted to be in 10 to the power of 40 years or something like that.
There's kind of alot going on, but the shortest answer is "the electrostatic force between the positive nucleus and negative electron creates orbits in the same way that gravity allows a moon to orbit a planet". The electron is moving fast enough that it just "misses" the nucleus. At least, from a classical lens.
It gets more complicated when you introduce orbital angular momentum and start considering the magnetic effects of moving charges, and that's what leads to the funky non-spherical orbital shapes.
The language of forces and balancing forces comes from classical mechanics.
The particles interact via electromagnetic waves. You simply have to apply quantum mechanics and solve the Schrodinger equation. It's a different kind of thing.
The electron orbits are quantized, with a lower limit. As found by Neils Bohr. Classical theory would have the electron attracted into the nucleus in a tiny fraction of a second. His theory was not liked at the time and he faced a lot of push back, but they eventually accepted it as it’s true.