stdin is a file pointer that represents the standard input. That's usually the keyboard, unless you've redirected it somehow.
How does the file pointer work? The file pointer itself doesn't "do" anything, it just represents something (a file, usually) that you can get data from or write data to.
fscanf reads characters from the file pointer. Specifically, it reads sequences of characters separated by whitespace. Each sequence is a token.
When it manages to read a token, it looks at the next formatting symbol in the string you gave it and tries to convert that token into the corresponding data type.
For example, %s means to convert to a char*. %d means to convert to a decimal integer.
Once it converts to the proper data type, it stores it in the corresponding argument to fscanf.
fprintf works backwards; it takes data from your program as arguments and tries to convert it to the character representation specified by the formatting string. Then it writes it to the given file pointer.