In a few more words, physicists right now are confident in saying that there are four fundamental things that happen:
- Protons and neutrons stick together. (The "strong nuclear interaction".)
- Neutrons sometimes "fall apart" into a proton, electron, and antineutrino. Sometimes this can happen in reverse, too. (The "weak nuclear interaction", also known as "beta decay" or "radioactivity".)
- Positive charges repel other positive charges and attract negative charges. (The "electromagnetic interaction", also known as "chemistry" and "light".)
- Things fall down. ("The gravitational interaction".)
(I said that these were in order of "decreasing everyday strength," but that's not very precise given that these things scale differently with distance etc. But this is the rough order that you should be thinking about the problem you're interested in.)
Everything else you are used to is caused by these 4 fundamental interactions. For example when you are sitting in a chair, secretly the force holding you up is a force of electron clouds around nuclei repelling each other, so this is chiefly the "electromagnetic" forces at play opposing the "gravitational" forces pulling you down.
There is also a slight subtlety which these 4 interactions do not completely cover, but every physicist knows about it: it says that "two identical particles cannot remain in an identical state." This usually means that those particles have to occupy higher and higher-energy states. It turns out a lot of the structure of the periodic table comes from this rule! This rule ultimately says that the number of columns you add (when you add columns to the periodic table) must be twice the next odd number: so you see that we start off adding 2 columns, then we add 6 columns, then we add 10 columns, then we add 14 columns; the physics says that the next number of columns to add would be 18 and that the pattern is seen when you divide by 2, you first add one pair, then three pairs, then five pairs, then seven pairs: increasing odd numbers. And this is just because each new electron needs to be (a) orbiting further away and (b) possibly spinning faster.
So as a nucleus gets bigger and bigger, a similar story happens. The neutrons and protons cooperate due to the strong nuclear interaction. They, it turns out, really like to stick to each other! But then the second effect takes hold: if a nucleus has too many protons, they have to be in really spinny high-energy states in the nucleus, because the lower-energy states are already occupied by other protons! But there are lower-energy neutron states which are unoccupied. At some point it becomes energetically favorable for a proton to reverse-beta-decay into a positron plus a neutron plus a neutrino, so that the neutron can fall into that lowest-energy state.
So that's what the neutrons do in the nucleus: they are "about as sticky" as the protons but they are different particles that can occupy the other states.
Now you might also think, "oh, those protons are repelling each other also, due to the electromagnetic interaction." And that is true, but it is a weaker effect than either of these. That effect basically balances out at a certain atomic number, which happens to be Iron. All of the smaller atoms are driven more by the strong nuclear force to want to "fuse" together into larger atoms, trying to be iron. And all of the bigger atoms are driven more by the electromagnetic repulsion to want to "fission" apart into smaller atoms. (But of course until you get to intrinsically-unstable atomic numbers like Uranium, you can still have little stable states of larger-than-iron atoms, where if you fire a neutron into the nucleus it might fall apart but for right now it's jiggling around safely.)
See also: Wikipedia's articles on stable nuclides and nuclear binding energies.