It could be a bad bake-broil switch. It could be a bad thermostat.
When you turn on the oven and it DOESN'T work, take the back panel off the oven and check for 220 volt power across the terminals of both the lower bake and upper broil elements. Newer ovens will alternate power between the bake and broil elements for more uniform cooking temperatures. If there is 220 volt power at the terminal block, but you don't measure 220 volts at either element, then something not allowing power through to the elements.